commit_hash stringlengths 40 40 | author stringlengths 1 57 | date timestamp[s]date 2010-07-26 04:45:09 2026-04-14 18:21:10 | message stringlengths 8 1.39M | diff stringlengths 68 51.2k | files_changed int64 1 136 | insertions int64 0 2.35k | deletions int64 0 1.9k |
|---|---|---|---|---|---|---|---|
07a6df26b4d892a4b67d53e06a988b41684d4bc5 | Alex Crichton | 2014-07-03T05:25:58 | Add signed cookies | diff --git a/Cargo.toml b/Cargo.toml
index ef23015..70cc87a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -7,3 +7,7 @@ version = "0.0.1"
[[lib]]
name = "cookie"
+
+[dependencies.openssl]
+
+git = "https://github.com/sfackler/rust-openssl"
diff --git a/src/cookie.rs b/src/cookie.rs
index 8334858..a3dc3fe 100644
--- a/... | 3 | 141 | 23 |
538b4083fb0b40b55fdf2b15a0e9c81987b9a194 | Alex Crichton | 2014-07-03T03:51:59 | Default cookies to '/' to be sane | diff --git a/src/cookie.rs b/src/cookie.rs
index a028622..8334858 100644
--- a/src/cookie.rs
+++ b/src/cookie.rs
@@ -33,7 +33,7 @@ impl Cookie {
expires: None,
max_age: None,
domain: None,
- path: None,
+ path: Some("/".to_string()),
secure: fals... | 1 | 1 | 1 |
724003decad72cdbe3f998b0b8d181682e9582c5 | Alex Crichton | 2014-07-02T19:20:05 | Decode name/value | diff --git a/src/cookie.rs b/src/cookie.rs
index afa49a0..a028622 100644
--- a/src/cookie.rs
+++ b/src/cookie.rs
@@ -49,8 +49,8 @@ impl Cookie {
let mut pairs = s.trim().split(';');
let keyval = try_option!(pairs.next());
let (name, value) = try!(split(keyval));
- c.name = name.to_stri... | 1 | 8 | 2 |
923aca800a9859ac9156aab8988a19f2c47adca8 | Alex Crichton | 2014-06-30T15:36:55 | Put cookies a year in the past | diff --git a/src/jar.rs b/src/jar.rs
index b51eaba..c056b23 100644
--- a/src/jar.rs
+++ b/src/jar.rs
@@ -48,7 +48,9 @@ impl CookieJar {
for cookie in self.removed_cookies.iter() {
let mut c = Cookie::new(cookie.clone(), String::new());
c.max_age = Some(0);
- c.expires = Som... | 1 | 3 | 1 |
31c5f6e123db53b328298b9a00e34ee36b85c2f5 | Alex Crichton | 2014-06-30T15:34:26 | Add a delta function for headers | diff --git a/src/jar.rs b/src/jar.rs
index 75bffbf..b51eaba 100644
--- a/src/jar.rs
+++ b/src/jar.rs
@@ -1,4 +1,5 @@
use std::collections::{HashMap, HashSet};
+use time;
use Cookie;
@@ -41,6 +42,20 @@ impl CookieJar {
self.new_map.find(&name).or_else(|| self.orig_map.find(&name))
}
}
+
... | 1 | 15 | 0 |
fa74f63aea827489080e2ac7784643c36a9782f1 | Alex Crichton | 2014-06-30T15:23:13 | Super simple cookies and cookie jar | diff --git a/src/cookie.rs b/src/cookie.rs
index 2ba8cc5..afa49a0 100644
--- a/src/cookie.rs
+++ b/src/cookie.rs
@@ -8,6 +8,10 @@ use std::collections::TreeMap;
use std::fmt;
use std::from_str::FromStr;
+pub use jar::CookieJar;
+
+mod jar;
+
#[deriving(PartialEq, Clone)]
pub struct Cookie {
pub name: String,... | 2 | 65 | 0 |
d6918d12f8c4b9a0b5f958ca841e5eea3eb155ac | Alex Crichton | 2014-06-30T05:06:05 | Add some basic cookie parsing/printing | diff --git a/src/cookie.rs b/src/cookie.rs
index c686064..2ba8cc5 100644
--- a/src/cookie.rs
+++ b/src/cookie.rs
@@ -1,5 +1,149 @@
+#![feature(macro_rules)]
#![crate_type = "lib"]
+extern crate url;
+extern crate time;
+
+use std::collections::TreeMap;
+use std::fmt;
+use std::from_str::FromStr;
+
+#[deriving(Partia... | 1 | 144 | 0 |
3e35184fc181fef63bc11dedb22413e821168255 | Sergio Benitez | 2024-03-13T07:36:21 | New version: 1.0.1. | diff --git a/Cargo.toml b/Cargo.toml
index 8e27bbb..d4beb98 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "yansi"
-version = "1.0.0"
+version = "1.0.1"
authors = ["Sergio Benitez <sb@sergio.bz>"]
repository = "https://github.com/SergioBenitez/yansi"
documentation = "https://docs.rs/yans... | 1 | 1 | 1 |
7cb1316ff2a0e8196ba137e1fb4f5feb58a8ac59 | Sergio Benitez | 2024-03-07T04:34:54 | Deprecate and rename 'clear' to 'resetting'.
Resolves #42. | diff --git a/src/attr_quirk.rs b/src/attr_quirk.rs
index 8a697b8..255e54e 100644
--- a/src/attr_quirk.rs
+++ b/src/attr_quirk.rs
@@ -104,20 +104,27 @@ pub enum Quirk {
///
/// See the [crate level docs](crate#wrapping) for details.
Wrap,
- /// Linger: do not clear the style after it is applied.
+ /... | 6 | 72 | 27 |
3e01eaef502d0ee09fbc551409ae6ce400c77868 | Sergio Benitez | 2024-03-06T07:28:27 | Fill in missing gaps in rustdocs. | diff --git a/src/attr_quirk.rs b/src/attr_quirk.rs
index d5b5fff..8a697b8 100644
--- a/src/attr_quirk.rs
+++ b/src/attr_quirk.rs
@@ -17,9 +17,9 @@ use crate::Style;
/// the terminal's configuration. Common attributes, such as `bold`, `dim`,
/// `italic`, `underline`, and `strike` typically have good support and are
... | 6 | 92 | 39 |
61af1acaae54df661a5fb9d35d8c8a3f397e580f | Sergio Benitez | 2024-03-06T01:31:57 | Use 'is-terminal' >= 0.4.11 to decrease deps. | diff --git a/Cargo.toml b/Cargo.toml
index 613cdab..b122b2d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,6 +11,7 @@ license = "MIT OR Apache-2.0"
categories = ["command-line-interface"]
rust-version = "1.63"
edition = "2021"
+resolver = "2"
[package.metadata.docs.rs]
all-features = true
@@ -27,4 +28,4 @@ allo... | 1 | 2 | 1 |
8bc8ba06ab69e55efe77656b4583277782de74e2 | Sergio Benitez | 2023-08-10T21:15:09 | Re-enable tests that assume yansi colors. | diff --git a/src/global.rs b/src/global.rs
index 46adba3..99f13ae 100644
--- a/src/global.rs
+++ b/src/global.rs
@@ -6,7 +6,7 @@ static ENABLED: AtomicCondition = AtomicCondition::DEFAULT;
///
/// # Example
///
-/// ```rust,no_run
+/// ```rust
/// use yansi::Paint;
///
/// // With styling enabled, ANSI color code... | 3 | 5 | 5 |
0bf346e715a567126759684e1719b217d78fbb70 | Sergio Benitez | 2023-08-10T21:13:28 | On Windows, query console directly, not stdout.
On Windows, we must manually enable VT processing on the console. Prior to this
commit, we attempted to obtain a handle to the console by querying stdout. If
stdout has been redirected, however, then the handle doesn't correspond to the
console but instead to the redirec... | diff --git a/src/windows.rs b/src/windows.rs
index 581869c..5f7bbb1 100644
--- a/src/windows.rs
+++ b/src/windows.rs
@@ -1,59 +1,95 @@
#[cfg(windows)]
+#[allow(non_camel_case_types, non_snake_case)]
mod windows_console {
use core::ffi::c_void;
- use crate::condition::CachedBool;
+ type c_ulong = u32;
+ ... | 1 | 60 | 23 |
c9dab3f08926d82206f0a73fe771e0728f6cda79 | Sergio Benitez | 2023-07-07T02:25:09 | Improve docs throughout. | diff --git a/src/condition.rs b/src/condition.rs
index 11a3e1d..85a9719 100644
--- a/src/condition.rs
+++ b/src/condition.rs
@@ -4,6 +4,19 @@ use core::sync::atomic::{AtomicPtr, Ordering};
/// A function that decides whether styling should be applied.
///
+/// A styling `Condition` can be specified globally via
+//... | 4 | 83 | 13 |
50645077452f4c560676fd68eabf2d1c4cfb6db0 | Sergio Benitez | 2023-07-05T22:52:30 | Add 'clear' quirk. Rename 'prefix', 'suffix'.
The `prefix_seq` and `suffix_seq` `Style` methods are renamed to `prefix` and
`suffix`, respectively. | diff --git a/src/attr_quirk.rs b/src/attr_quirk.rs
index 3495d0f..d5b5fff 100644
--- a/src/attr_quirk.rs
+++ b/src/attr_quirk.rs
@@ -111,6 +111,13 @@ pub enum Quirk {
///
/// See the [crate level docs](crate#lingering) for details.
Linger,
+ /// Always clear styling afterwards, even if no actual styli... | 4 | 24 | 11 |
04a1bec992b6605f6c7d0ceafc9fa56146a27425 | Sergio Benitez | 2023-06-22T01:22:41 | Fix 'is_enabled()' doctest. | diff --git a/src/global.rs b/src/global.rs
index e780736..46adba3 100644
--- a/src/global.rs
+++ b/src/global.rs
@@ -94,6 +94,7 @@ pub fn whenever(condition: Condition) {
///
/// ```rust
/// // Styling is enabled by default.
+/// # yansi::enable();
/// assert!(yansi::is_enabled());
///
/// // Disable it with `Pai... | 1 | 1 | 0 |
cba5e319cc81e7368a5df73e1bc7f366c625dc80 | Sergio Benitez | 2023-06-22T00:54:46 | Make the default condition check for OS support.
This removes the Windows-specific check one every paint. This enables overriding
the check for Windows support, which on failure would previously disbale
coloring. We use this during integration testing to force-enable coloring. | diff --git a/src/condition.rs b/src/condition.rs
index 8116976..cecdd5c 100644
--- a/src/condition.rs
+++ b/src/condition.rs
@@ -59,6 +59,13 @@ pub struct AtomicCondition(AtomicPtr<()>);
pub struct CachedBool(AtomicU8);
impl Condition {
+ /// A condition that evaluates to `true` if the OS supports coloring.
+ ... | 6 | 90 | 46 |
fc341a0ceff44586ffa705463048be76e57fac5e | Sergio Benitez | 2023-06-21T22:24:57 | Add integration tests. | diff --git a/src/global.rs b/src/global.rs
index f307c5a..81e9dac 100644
--- a/src/global.rs
+++ b/src/global.rs
@@ -6,7 +6,7 @@ static ENABLED: AtomicCondition = AtomicCondition::ALWAYS;
///
/// # Example
///
-/// ```rust
+/// ```rust,no_run
/// use yansi::Paint;
///
/// // With styling enabled, ANSI color codes... | 5 | 338 | 9 |
6eda2e59b0792aa174d787c3cc85e7c0b54c10d7 | Sergio Benitez | 2022-12-13T15:33:02 | Clippy fixes. | diff --git a/src/color.rs b/src/color.rs
index 1c3d992..d592382 100644
--- a/src/color.rs
+++ b/src/color.rs
@@ -82,8 +82,8 @@ impl Color {
Color::Magenta => write!(f, "5"),
Color::Cyan => write!(f, "6"),
Color::White => write!(f, "7"),
- Color::Fixed(num) => write!(f, ... | 2 | 4 | 4 |
23a6069d67a510fd6875d7da1ac0a644d8912a79 | Sergio Benitez | 2022-12-13T15:32:32 | Free changes from cargo fix. | diff --git a/src/color.rs b/src/color.rs
index 1d3b6d7..1c3d992 100644
--- a/src/color.rs
+++ b/src/color.rs
@@ -70,7 +70,7 @@ impl Color {
Style::new(self)
}
- pub(crate) fn ansi_fmt(&self, f: &mut fmt::Write) -> fmt::Result {
+ pub(crate) fn ansi_fmt(&self, f: &mut dyn fmt::Write) -> fmt::Result... | 2 | 4 | 4 |
fe19ffc988897d7848565477cee3d1a8e908458c | Daniel Kahn Gillmor | 2022-03-10T00:02:06 | Use 'serial_test' instead of 'parking_lot::Mutex'.
Closes #34. | diff --git a/Cargo.toml b/Cargo.toml
index 04debd5..48fb9d5 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -16,4 +16,4 @@ travis-ci = { repository = "SergioBenitez/yansi", branch = "master" }
[dependencies]
[dev-dependencies]
-parking_lot = { version = "0.5", features = ["nightly"] }
+serial_test = "0.6"
diff --git a/... | 2 | 9 | 8 |
53a92c2d762adc08664e395431c264e672f66be2 | Sergio Benitez | 2022-03-23T00:32:19 | Fix broken 'Style::masked()' doc link. | diff --git a/src/lib.rs b/src/lib.rs
index 9739f5f..2908d65 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -99,9 +99,8 @@
//! Items can be arbitrarily _masked_. When an item is masked and painting is
//! disabled, the `Display` and `Debug` implementations of `Paint` write
//! nothing. This allows you to selectively omi... | 1 | 2 | 3 |
0dd0178409fa199a36795f859927acc99b556113 | Nicholas Nethercote | 2022-03-11T05:30:48 | Remove the `docify!` macro.
This reduces the compile time for a non-incremental `cargo check` build
by about 60%. It also reduces the amount of code and is easier to read
because it uses standard Rust macros (`concat` and `stringify`) rather
than a DSL. | diff --git a/src/docify.rs b/src/docify.rs
deleted file mode 100644
index 08895d4..0000000
--- a/src/docify.rs
+++ /dev/null
@@ -1,63 +0,0 @@
-macro_rules! docify {
- ([$($doc:tt)*]; $($tt:tt)*) => {
- docify!([$($doc)*] [] $($tt)*);
- };
-
- // FIXME: Treat $a just like everywhere else. What if we star... | 5 | 34 | 101 |
bb9f708a7cb8b84a4e277e1977629d51ae9035ed | Felix Rabe | 2019-04-29T20:34:59 | Fix references to ANSI. | diff --git a/src/color.rs b/src/color.rs
index fee620a..1d3b6d7 100644
--- a/src/color.rs
+++ b/src/color.rs
@@ -70,7 +70,7 @@ impl Color {
Style::new(self)
}
- pub(crate) fn ascii_fmt(&self, f: &mut fmt::Write) -> fmt::Result {
+ pub(crate) fn ansi_fmt(&self, f: &mut fmt::Write) -> fmt::Result {
... | 5 | 20 | 20 |
a9e19ff4168283e451a3389aca1ddd45b5d7912b | Sergio Benitez | 2019-05-08T18:22:32 | Move to 0.6.0-dev. | diff --git a/Cargo.toml b/Cargo.toml
index c6c4392..04debd5 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "yansi"
-version = "0.5.0"
+version = "0.6.0-dev"
authors = ["Sergio Benitez <sb@sergio.bz>"]
repository = "https://github.com/SergioBenitez/yansi"
documentation = "https://docs.rs/... | 1 | 1 | 1 |
f80bf49c7aa731e0a3c8185be20f5a417070bcbb | Felix Rabe | 2019-04-29T20:42:52 | Fix typo: '256-bit' -> '8-bit'. | diff --git a/src/paint.rs b/src/paint.rs
index e00e896..ec3f829 100644
--- a/src/paint.rs
+++ b/src/paint.rs
@@ -191,7 +191,7 @@ impl<T> Paint<T> {
}
/// Constructs a new `Paint` structure encapsulating `item` with the
- /// foreground color set to the fixed 256-bit color `color`.
+ /// foreground col... | 1 | 1 | 1 |
59c3a918d2ed9c7309a868a409c179c5246e7cd5 | Sergio Benitez | 2018-11-19T08:50:36 | Implement wrapping. Remove unnecessary 'Style' methods. | diff --git a/src/color.rs b/src/color.rs
index 25c7493..fee620a 100644
--- a/src/color.rs
+++ b/src/color.rs
@@ -8,6 +8,9 @@ pub enum Color {
/// No color has been set. Nothing is changed when applied.
Unset,
+ /// Terminal default #9. (foreground code `39`, background code `49`).
+ Default,
+
//... | 7 | 345 | 193 |
32e1911f089b29b8b286674036131ad48b3c080c | Sergio Benitez | 2018-07-06T07:42:05 | Add regression test for 'Style' 'Hash' impl. | diff --git a/src/tests.rs b/src/tests.rs
index 5355a78..1f18f33 100644
--- a/src/tests.rs
+++ b/src/tests.rs
@@ -1,7 +1,7 @@
extern crate parking_lot;
use super::Color::*;
-use super::Paint;
+use super::{Paint, Style};
use self::parking_lot::Mutex;
@@ -130,3 +130,21 @@ fn masked_when_enabled() {
Paint... | 1 | 19 | 1 |
135518244c76047be81aa093d3c8b8551e19a934 | Sergio Benitez | 2018-06-24T04:56:46 | Inline fewer functions. | diff --git a/src/color.rs b/src/color.rs
index 98c307b..25c7493 100644
--- a/src/color.rs
+++ b/src/color.rs
@@ -67,7 +67,6 @@ impl Color {
Style::new().fg(self)
}
- #[inline(always)]
pub(crate) fn ascii_fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
Colo... | 2 | 1 | 3 |
4573c9b6208d111a0fb60107e695ad6353770ac4 | Sergio Benitez | 2018-06-24T04:44:52 | Rename 'Purple' to 'Magenta'.
Resolves #6. | diff --git a/src/color.rs b/src/color.rs
index 6f249f7..98c307b 100644
--- a/src/color.rs
+++ b/src/color.rs
@@ -23,8 +23,8 @@ pub enum Color {
/// Blue: #4 (foreground code `34`, background code `44`).
Blue,
- /// Purple: #5 (foreground code `35`, background code `45`).
- Purple,
+ /// Magenta: #5... | 4 | 11 | 11 |
6267e67df9a7090475574917826166f1476b947a | Sergio Benitez | 2018-06-24T04:42:35 | Fix 'Hash' implementation for 'Style'.
Fixes #5. | diff --git a/src/style.rs b/src/style.rs
index 55b5f5e..6096ab2 100644
--- a/src/style.rs
+++ b/src/style.rs
@@ -1,3 +1,4 @@
+use std::hash::{Hash, Hasher};
use std::fmt::{self, Display};
use std::ops::BitOr;
@@ -146,7 +147,7 @@ impl Iterator for Iter {
/// * [`style.fmt_prefix(f: &mut fmt::Formatter)`](Style::f... | 1 | 10 | 1 |
196790f10b4eb91457a120333b9be1190a968682 | Sergio Benitez | 2018-06-24T04:39:18 | Minor doc fixes and atomic loading. | diff --git a/src/docify.rs b/src/docify.rs
index be68359..5c9a8b7 100644
--- a/src/docify.rs
+++ b/src/docify.rs
@@ -61,5 +61,3 @@ macro_rules! docify {
$($tt)*
};
}
-
-
diff --git a/src/macros.rs b/src/macros.rs
index aab93c1..8e9126d 100644
--- a/src/macros.rs
+++ b/src/macros.rs
@@ -1,7 +1,7 @@
macro... | 3 | 2 | 4 |
a3be6107c9a12f155a6f87022d589156d5be24ef | Sergio Benitez | 2018-02-26T01:30:54 | Clarify behavior of 'style.fmt_{prefix,suffix}'. | diff --git a/src/style.rs b/src/style.rs
index 8e68398..55b5f5e 100644
--- a/src/style.rs
+++ b/src/style.rs
@@ -380,9 +380,14 @@ impl Style {
/// [`fmt::Debug`] implementations for custom or specialized use-cases. Most
/// users should use [`Paint`] for all painting needs.
///
+ /// This method write... | 1 | 10 | 0 |
5766053294d25b65c50e1773b3ab6db368d7f146 | Sergio Benitez | 2018-02-21T08:24:59 | Version 0.4.0. | diff --git a/Cargo.toml b/Cargo.toml
index ca6ad04..2f7f85c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "yansi"
-version = "0.4.0-rc.2"
+version = "0.4.0"
authors = ["Sergio Benitez <sb@sergio.bz>"]
repository = "https://github.com/SergioBenitez/yansi"
documentation = "https://docs.rs... | 1 | 1 | 1 |
d4685d066a621cf6e579b806d03a804ca66a4078 | Sergio Benitez | 2018-02-21T08:20:42 | Reenable all tests. | diff --git a/src/tests.rs b/src/tests.rs
index 0ace66b..739202a 100644
--- a/src/tests.rs
+++ b/src/tests.rs
@@ -118,15 +118,15 @@ fn masked_when_disabled() {
fn masked_when_enabled() {
assert_renders! {
Paint::masked("text/plain") => "text/plain",
- // Paint::masked("text/plain").mask() => "text/... | 1 | 10 | 10 |
6c6781a4bb4464f3408a23235190a9d4a7876efd | Sergio Benitez | 2018-02-21T08:19:02 | Add Travis badge to Cargo.toml. | diff --git a/Cargo.toml b/Cargo.toml
index 1eaa11c..ca6ad04 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -10,6 +10,9 @@ readme = "README.md"
license = "MIT/Apache-2.0"
categories = ["command-line-interface"]
+[badges]
+travis-ci = { repository = "SergioBenitez/yansi", branch = "master" }
+
[dependencies]
[dev-de... | 1 | 3 | 0 |
4723629314f27fe65231d6b46ad93bc9b4168765 | Sergio Benitez | 2018-01-30T22:30:13 | Move to 0.4: remove "nightly" feature.
The "constness" of 'AtomicBool::new' will be stabilized in Rust 1.24.
This means that all of 'yansi' will compile on stable Rust soon! Thus,
there is no need for a "nightly" feature. | diff --git a/Cargo.toml b/Cargo.toml
index 618dc8f..3549508 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "yansi"
-version = "0.3.4"
+version = "0.4.0-dev"
authors = ["Sergio Benitez <sb@sergio.bz>"]
repository = "https://github.com/SergioBenitez/yansi"
documentation = "https://docs.rs/... | 3 | 59 | 56 |
35b97d62440023488392c8a1adb216741737da28 | Sergio Benitez | 2017-09-17T10:30:12 | Revamp tests. Dedup 'fmt' trait impls. | diff --git a/Cargo.toml b/Cargo.toml
index 85fbdcb..618dc8f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -15,5 +15,8 @@ nightly = []
[dependencies]
+[dev-dependencies]
+parking_lot = { version = "0.4", features = ["nightly"] }
+
[package.metadata.docs.rs]
all-features = true
diff --git a/src/lib.rs b/src/lib.rs
i... | 3 | 148 | 64 |
8bfa5d34ed3c508003f0e98e50f604ce637e0b0e | Sergio Benitez | 2017-09-17T01:31:59 | New version: 0.3.4. | diff --git a/Cargo.toml b/Cargo.toml
index 423dc26..85fbdcb 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "yansi"
-version = "0.3.3"
+version = "0.3.4"
authors = ["Sergio Benitez <sb@sergio.bz>"]
repository = "https://github.com/SergioBenitez/yansi"
documentation = "https://docs.rs/yans... | 1 | 1 | 1 |
ba4a6c9f5ce41bce339b06b0f5560186191f5034 | Sergio Benitez | 2017-09-17T01:31:28 | Update for latest nightly. | diff --git a/src/lib.rs b/src/lib.rs
index 9b35518..f611387 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,4 +1,4 @@
-#![cfg_attr(feature="nightly", feature(const_fn))]
+#![cfg_attr(feature="nightly", feature(const_atomic_bool_new))]
#![doc(html_root_url = "https://docs.rs/yansi/0.3")]
//! A dead simple ANSI termin... | 1 | 1 | 1 |
1036ce429ea78faf60f2aa926e77ef044d95cbed | Sergio Benitez | 2017-08-11T17:04:40 | New version: 0.3.3. | diff --git a/Cargo.toml b/Cargo.toml
index 49464f8..423dc26 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "yansi"
-version = "0.3.2"
+version = "0.3.3"
authors = ["Sergio Benitez <sb@sergio.bz>"]
repository = "https://github.com/SergioBenitez/yansi"
documentation = "https://docs.rs/yans... | 1 | 1 | 1 |
027ec51d985637f27ad17846b323741176f9d926 | Sergio Benitez | 2017-08-11T17:03:01 | Enable colors on stderr on Windows when necessary. | diff --git a/src/windows.rs b/src/windows.rs
index 99b02f5..324cfc3 100644
--- a/src/windows.rs
+++ b/src/windows.rs
@@ -11,6 +11,7 @@ mod windows_console {
const ENABLE_VIRTUAL_TERMINAL_PROCESSING: DWORD = 0x0004;
const STD_OUTPUT_HANDLE: DWORD = 0xFFFFFFF5;
+ const STD_ERROR_HANDLE: DWORD = 0xFFFFFFF4;... | 1 | 35 | 14 |
1f06deb3f756ecf2875a50ca74c20470ebae0005 | Sergio Benitez | 2017-07-27T02:44:25 | Fix mispelling of ANSI. | diff --git a/src/lib.rs b/src/lib.rs
index 5c937a0..9b35518 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -127,7 +127,7 @@
//!
//! # Windows
//!
-//! Since the Windows 10 anniversary update, Windows consoles support ANSII
+//! Since the Windows 10 anniversary update, Windows consoles support ANSI
//! escape sequences... | 1 | 1 | 1 |
80e29c0b23474ca7da1077bb71a2f2147380b052 | Sergio Benitez | 2017-07-26T21:46:58 | New version: 0.3.2. | diff --git a/Cargo.toml b/Cargo.toml
index 3e9931d..49464f8 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "yansi"
-version = "0.3.1"
+version = "0.3.2"
authors = ["Sergio Benitez <sb@sergio.bz>"]
repository = "https://github.com/SergioBenitez/yansi"
documentation = "https://docs.rs/yans... | 1 | 1 | 1 |
423d55a71818760e0eae45e597d47130f5427cd7 | Sergio Benitez | 2017-07-26T21:46:44 | Use docs.rs instead of custom hosted docs. | diff --git a/Cargo.toml b/Cargo.toml
index 51df3a7..3e9931d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,7 +3,7 @@ name = "yansi"
version = "0.3.1"
authors = ["Sergio Benitez <sb@sergio.bz>"]
repository = "https://github.com/SergioBenitez/yansi"
-documentation = "https://sergio.bz/rustdocs/yansi"
+documentation = ... | 2 | 5 | 1 |
f60a62b13682c8a8e9c777867e0f46c17b6014c5 | Sergio Benitez | 2017-07-26T21:42:28 | Add masking to the differentiation section. | diff --git a/src/lib.rs b/src/lib.rs
index 3557ad3..2b83419 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -151,6 +151,7 @@
//! * Like [`term_painter`], but unlike [`ansi_term`], _any_ type implementing
//! `Display` can be stylized, not only strings.
//! * Styling can be enabled and disabled on the fly.
+//! ... | 1 | 1 | 0 |
1ed50c5f874fc80c9fdf13281c6d3bd3dc2807dc | Sergio Benitez | 2017-07-26T21:41:39 | New version: 0.3.1. | diff --git a/Cargo.toml b/Cargo.toml
index 313b216..51df3a7 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "yansi"
-version = "0.3.0"
+version = "0.3.1"
authors = ["Sergio Benitez <sb@sergio.bz>"]
repository = "https://github.com/SergioBenitez/yansi"
documentation = "https://sergio.bz/ru... | 1 | 1 | 1 |
ef0601629b52bc760d66c23bd13536da5bf031d8 | Sergio Benitez | 2017-07-26T21:38:56 | Add support for Windows ASCII and masked items. | diff --git a/src/lib.rs b/src/lib.rs
index ee07ef2..3557ad3 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -24,16 +24,20 @@
//! implementation.
//!
//! `Paint` can be constructed via any of following methods: [`black`], [`red`],
-//! [`green`], [`yellow`], [`blue`], [`purple`], [`cyan`], [`white`]. You can
-//! also us... | 2 | 177 | 46 |
aeb5aefbb114405f775cae58c39ab1b1a34b72ca | Sergio Benitez | 2017-06-06T20:40:18 | New version: 0.3. | diff --git a/Cargo.toml b/Cargo.toml
index 86e19aa..313b216 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "yansi"
-version = "0.2.0"
+version = "0.3.0"
authors = ["Sergio Benitez <sb@sergio.bz>"]
repository = "https://github.com/SergioBenitez/yansi"
documentation = "https://sergio.bz/ru... | 1 | 1 | 1 |
1268fbcbefa3f41f6d2961257b13d4016af04875 | Sergio Benitez | 2017-06-06T20:39:39 | Change Debug impl to color instead of printing internals. | diff --git a/src/lib.rs b/src/lib.rs
index e5591f5..ee07ef2 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -17,13 +17,24 @@
//!
//! ## `Paint`
//!
-//! The only entry paint to this library is the `Paint` type. `Paint`
-//! encapsulates a value of any type that implements the `Display` trait. When a
-//! `Paint` is `Dis... | 1 | 44 | 35 |
11d1bfde3517b346e74f3707fdb1279af9194967 | Sergio Benitez | 2017-06-03T08:33:57 | Minor improvements to docs. | diff --git a/src/lib.rs b/src/lib.rs
index acf68ba..e5591f5 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -128,13 +128,13 @@
//! * This library is _much_ simpler: there are two types! The complete
//! implementation is under 200 lines of code.
//! * Like [`term_painter`], but unlike [`ansi_term`], _any_ type i... | 1 | 2 | 2 |
eba3354016056daa0c09934d0f76391185f378e6 | Sergio Benitez | 2017-06-03T08:32:54 | Add CLICOLOR example. | diff --git a/src/lib.rs b/src/lib.rs
index 1ceec6b..acf68ba 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -83,6 +83,21 @@
//! of the contained object and nothing else. Painting can be reenabled via the
//! [`Paint::enable()`] method.
//!
+//! One potential use of this feature is to allow users to control color ouput
+... | 1 | 21 | 1 |
9331ee605c18bc759019aed85a8ba27574859cfa | Sergio Benitez | 2017-06-03T07:54:12 | Fix crate-level deps link. | diff --git a/src/lib.rs b/src/lib.rs
index 96982dc..1ceec6b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -228,7 +228,7 @@ struct Style {
/// A structure encapsulating all of the styling for a given item.
///
-/// See the [crate level documentation](../) for usage information.
+/// See the [crate level documentation]... | 1 | 1 | 1 |
26edf79cf190342d31a484320ec54837269d1394 | Sergio Benitez | 2017-06-02T04:37:56 | Document Color.paint. | diff --git a/src/lib.rs b/src/lib.rs
index eb8940c..96982dc 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -34,6 +34,20 @@
//! [`cyan`]: struct.Paint.html#method.cyan,
//! [`white`]: struct.Paint.html#method.white
//!
+//! You can also use the [`paint`] method on a given [`Color`] value to
+//! construct a `Paint` type... | 1 | 14 | 0 |
c072eed735297327d86b19821e2d8dcb01708724 | Sergio Benitez | 2017-06-02T04:28:18 | New version: 0.2.0. | diff --git a/Cargo.toml b/Cargo.toml
index e324530..86e19aa 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "yansi"
-version = "0.1.1"
+version = "0.2.0"
authors = ["Sergio Benitez <sb@sergio.bz>"]
repository = "https://github.com/SergioBenitez/yansi"
documentation = "https://sergio.bz/ru... | 1 | 1 | 1 |
20ff19456918a07e3547b10a1d83134870c1e68a | Sergio Benitez | 2017-06-02T04:27:53 | Rename Color::None to Color::Unset. | diff --git a/src/lib.rs b/src/lib.rs
index f87d3b8..eb8940c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -124,8 +124,8 @@ fn write_spliced<T: Display>(c: &mut bool, f: &mut fmt::Formatter, t: T) -> fmt:
/// An enum representing an ANSI color code.
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Copy, Clone)]
pu... | 1 | 6 | 6 |
254fa5257bfe4a47fb441320c8f7202fa842215e | Sergio Benitez | 2017-06-02T04:25:42 | New version: 0.1.1. | diff --git a/Cargo.toml b/Cargo.toml
index 2c4c778..e324530 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "yansi"
-version = "0.1.0"
+version = "0.1.1"
authors = ["Sergio Benitez <sb@sergio.bz>"]
repository = "https://github.com/SergioBenitez/yansi"
documentation = "https://sergio.bz/ru... | 1 | 1 | 1 |
cb7bc58e46e2b0f2de35856e50e7fd44fd66cb79 | Sergio Benitez | 2017-06-02T04:25:26 | Add Color::paint for easier porting. | diff --git a/src/lib.rs b/src/lib.rs
index da542d1..f87d3b8 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -158,6 +158,21 @@ pub enum Color {
RGB(u8, u8, u8),
}
+impl Color {
+ /// Constructs a new `Paint` structure that encapsulates `item` with the
+ /// foreground color set to the color `self`.
+ ///
+ ... | 1 | 15 | 0 |
1bd70d842c6febcd16ec1fe3a954a84032b89f52 | Sgeo | 2018-03-20T05:11:42 | Republish again to fix documentation link | diff --git a/Cargo.toml b/Cargo.toml
index c3fc8c5..4a98924 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "take_mut"
-version = "0.2.1"
+version = "0.2.2"
authors = ["Sgeo <sgeoster@gmail.com>"]
license = "MIT"
homepage = "https://github.com/Sgeo/take_mut" | 1 | 1 | 1 |
4e339c28db1b911d9e2cf75216103c6b39619db3 | Sgeo | 2018-03-15T22:07:08 | Republish to fix documentation link. | diff --git a/Cargo.toml b/Cargo.toml
index 8a8d12b..c3fc8c5 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "take_mut"
-version = "0.2.0"
+version = "0.2.1"
authors = ["Sgeo <sgeoster@gmail.com>"]
license = "MIT"
homepage = "https://github.com/Sgeo/take_mut" | 1 | 1 | 1 |
dbdd82cf487e27250e4b3c32a5d2a68c1f6a1242 | Sgeo | 2017-08-06T21:46:53 | Add test. | diff --git a/src/scoped.rs b/src/scoped.rs
index e042c38..4997c6a 100644
--- a/src/scoped.rs
+++ b/src/scoped.rs
@@ -157,4 +157,19 @@ fn scope_based_take() {
b_hole.fill(Foo);
});
println!("{:?}", &bar);
+}
+
+#[test]
+fn panic_on_recovered_panic() {
+ use std::panic;
+
+ struct Foo;
+ l... | 1 | 15 | 0 |
5dba5d16866044141f8db7c306389a304a1493e3 | Sgeo | 2017-08-06T20:20:12 | Clarification. | diff --git a/src/scoped.rs b/src/scoped.rs
index e4cd6c0..e042c38 100644
--- a/src/scoped.rs
+++ b/src/scoped.rs
@@ -18,7 +18,7 @@
//! use take_mut::scoped;
//! struct Foo;
//! scoped::scope(|scope| {
-//! let mut foo = Foo; // Does not outlive scope.
+//! let mut foo = Foo; // Invalid because foo must come ... | 1 | 1 | 1 |
50af3c22b5247a8d50e16454697e3b4d100f5ba2 | Sgeo | 2017-08-06T20:18:31 | Some documentation suggestions from IRC. | diff --git a/src/scoped.rs b/src/scoped.rs
index e68687c..e4cd6c0 100644
--- a/src/scoped.rs
+++ b/src/scoped.rs
@@ -1,4 +1,4 @@
-//! This module provides a scoped API, allowing for taking an arbitrary amount of `&mut T` into `T` within one closure.
+//! This module provides a scoped API, allowing for taking an arbitra... | 1 | 2 | 2 |
3dcb0a7e229fbcebcb7f67ea455a1d0d9ec68f9c | Sgeo | 2017-08-06T20:17:10 | * Bump version number.
* Don't say that this crate only provides one function.
* scoped module documentation
* take_and_recover -> take_or_recover for consistency with standalone function.
* Switch to *mut within Holes. | diff --git a/Cargo.toml b/Cargo.toml
index 8c2baf3..8a8d12b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "take_mut"
-version = "0.1.3"
+version = "0.2.0"
authors = ["Sgeo <sgeoster@gmail.com>"]
license = "MIT"
homepage = "https://github.com/Sgeo/take_mut"
diff --git a/src/lib.rs b/src/... | 3 | 57 | 10 |
7a5d6c30a05c47a45d1f9ce6375f7b870c742cde | Sgeo | 2017-07-07T23:05:36 | * Remove useless panic catching from `Hole` destructor. Panics in recovery function will cause unfilled Hole to be noted. | diff --git a/src/scoped.rs b/src/scoped.rs
index 3ee3411..e73ab6a 100644
--- a/src/scoped.rs
+++ b/src/scoped.rs
@@ -82,19 +82,12 @@ impl<'c, 'm, T: 'm, F: FnOnce() -> T> Drop for Hole<'c, 'm, T, F> {
use std::ptr;
use std::mem;
- let result = panic::catch_unwind(panic::AssertUnwindSa... | 1 | 5 | 12 |
80ddae0dab6e86e32e8d82b439fd1eaa3f61a0b2 | Sgeo | 2017-07-07T23:01:03 | Switch from `std::process::exit(101)` to `std::process::abort()` | diff --git a/src/lib.rs b/src/lib.rs
index 5b4b405..10cf0b5 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -2,7 +2,7 @@
//!
//! `take()` allows for taking `T` out of a `&mut T`, doing anything with it including consuming it, and producing another `T` to put back in the `&mut T`.
//!
-//! During `take()`, if a panic occ... | 2 | 5 | 5 |
387c36a99ad4483cedc711fbd0ee5852d739a7dc | Sgeo | 2017-07-04T21:32:59 | Relocate scoped mechanism to separate module. | diff --git a/src/lib.rs b/src/lib.rs
index 5e9f367..5b4b405 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -9,6 +9,8 @@
use std::panic;
+pub mod scoped;
+
/// Allows use of a value pointed to by `&mut T` as though it was owned, as long as a `T` is made available afterwards.
///
/// The closure must return a valid ... | 2 | 123 | 120 |
02af2b3f0bf834f2f2cc489e2af80dd83e2ed1a4 | Sgeo | 2017-07-04T08:52:01 | Recovery code for scoped. | diff --git a/src/lib.rs b/src/lib.rs
index d4ad984..5e9f367 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -121,7 +121,7 @@ impl<'s> Scope<'s> {
hole = Hole {
active_holes: &self.active_holes,
hole: mut_ref,
- recovery: recovery
+ recovery: Some(... | 1 | 21 | 6 |
ec9e36d743a8f4c36b1e86de03362357a9c7998a | Sgeo | 2017-07-04T08:41:04 | Remove duplicated code. | diff --git a/src/lib.rs b/src/lib.rs
index cd503e3..d4ad984 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -121,31 +121,17 @@ impl<'s> Scope<'s> {
hole = Hole {
active_holes: &self.active_holes,
hole: mut_ref,
- recovery: Some(recovery)
+ recover... | 1 | 7 | 20 |
f2d87c8743c4eb18fbcfb2321c1682fda18b868a | Sgeo | 2017-07-04T08:25:01 | * Switch to Cell<usize>
* Semi-coherent lifetimes: 's for scope, 'c for &Cell, 'm for &mut | diff --git a/src/lib.rs b/src/lib.rs
index e8246d4..cd503e3 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -95,50 +95,84 @@ pub fn take_or_recover<T, F, R>(mut_ref: &mut T, recover: R, closure: F)
}
-use std::rc::Rc;
+use std::cell::Cell;
use std::marker::PhantomData;
pub struct Scope<'s> {
- active_holes: Rc<... | 1 | 56 | 22 |
9950e6841ca52bd5ac054b557250c0a479f8d98f | Sebastian Dröge | 2017-07-03T08:13:12 | Use panic::catch_unwind() for the normal take() too for consistency | diff --git a/src/exit_on_panic.rs b/src/exit_on_panic.rs
deleted file mode 100644
index 62bbb00..0000000
--- a/src/exit_on_panic.rs
+++ /dev/null
@@ -1,31 +0,0 @@
-/// Used to ensure an exit on panic.
-/// Call .done() to consume without exiting
-#[derive(Debug)]
-struct ExitOnSuddenDrop;
-
-impl ExitOnSuddenDrop {
-
-... | 2 | 7 | 41 |
12d02cd1f27f3a9b87b09b73e3d50582773dfc60 | Sebastian Dröge | 2017-07-03T08:12:33 | Use a closure for the recovery value for take_or_recover()
This allows not allocating the value unless actually necessary, i.e.
the main closure is panicking.
If the recovery closure panics, exit the process regardless. | diff --git a/src/lib.rs b/src/lib.rs
index b33f217..61768e8 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -71,22 +71,24 @@ fn it_works() {
/// ```
/// struct Foo;
/// let mut foo = Foo;
-/// take_mut::take_or_recover(&mut foo, Foo, |foo| {
+/// take_mut::take_or_recover(&mut foo, || Foo, |foo| {
/// // Can now co... | 1 | 8 | 6 |
53ae05902e587024a1254d84941ed0a025131477 | Sgeo | 2017-07-01T04:15:25 | * Lifetimes research at https://gist.github.com/Sgeo/0612efbe561b4883e7c79607e52e0a02
* Note unfortunate necessity of `&mut self`
* Use `Rc<()>` instead of `&Cell<usize>` due to aforementioned `&mut self` | diff --git a/src/lib.rs b/src/lib.rs
index 6d754cd..06702af 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -39,56 +39,65 @@ pub fn take<T, F>(mut_ref: &mut T, closure: F)
});
}
-use std::cell::Cell;
+use std::rc::Rc;
+use std::marker::PhantomData;
-pub struct Scope {
- active_holes: Cell<usize>
+pub struct Sc... | 1 | 39 | 30 |
87986a12501ba1121b2bed5faf383e45b599026e | Sgeo | 2017-07-01T03:22:02 | Use docs.rs automagically and put into Rust Patterns. | diff --git a/Cargo.toml b/Cargo.toml
index 08dbd2a..8c2baf3 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -6,4 +6,4 @@ license = "MIT"
homepage = "https://github.com/Sgeo/take_mut"
repository = "https://github.com/Sgeo/take_mut"
description = "Take a T from a &mut T temporarily"
-documentation = "https://crates.fyi/cr... | 1 | 1 | 1 |
0ed846e2bca04b586c5b80b313940277c760f855 | Sebastian Dröge | 2016-11-23T17:47:46 | Add take_or_recover() which replaces the value with a recovery value on panics
And then resumes to panic. | diff --git a/src/lib.rs b/src/lib.rs
index 8babf8d..b33f217 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -3,12 +3,14 @@
//! `take()` allows for taking `T` out of a `&mut T`, doing anything with it including consuming it, and producing another `T` to put back in the `&mut T`.
//!
//! During `take()`, if a panic occurs... | 1 | 85 | 3 |
7678c89fc8847982cea3f707c622674942cd1a30 | Sgeo | 2016-03-18T05:05:43 | Switch to exit_on_panic | diff --git a/src/lib.rs b/src/lib.rs
index 4ee9988..6d754cd 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -48,13 +48,13 @@ pub struct Scope {
impl Scope {
pub fn scope<F>(f: F)
where F: FnOnce(&Scope) {
- let aborter = AbortOnSuddenDrop::new();
- let this = Scope { active_holes: Cell::new(0) };
-... | 1 | 7 | 7 |
98672e972c5b2996e02d325aa6bac5aae0301a62 | Sgeo | 2016-03-18T05:00:41 | Revert "Removing scope-based take for a while, which I'm currently uncertain how to make safe."
This reverts commit 88a4451d362fe8dc89bac90ddea58b1c1b24957d.
# Conflicts:
# src/lib.rs | diff --git a/src/lib.rs b/src/lib.rs
index 8babf8d..4ee9988 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -39,6 +39,61 @@ pub fn take<T, F>(mut_ref: &mut T, closure: F)
});
}
+use std::cell::Cell;
+
+pub struct Scope {
+ active_holes: Cell<usize>
+}
+
+impl Scope {
+ pub fn scope<F>(f: F)
+ where F: FnOn... | 1 | 76 | 0 |
d0938c47c596ca12cafbffb3b1827c64d8c02910 | Sgeo | 2016-02-22T07:18:22 | Bump version. 0.1.2 had an incorrect test, which was in working directory but never committed. | diff --git a/Cargo.toml b/Cargo.toml
index 6ed6912..08dbd2a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,9 +1,9 @@
[package]
name = "take_mut"
-version = "0.1.2"
+version = "0.1.3"
authors = ["Sgeo <sgeoster@gmail.com>"]
license = "MIT"
homepage = "https://github.com/Sgeo/take_mut"
repository = "https://github.... | 1 | 2 | 2 |
a34df6423f1880bd0375684c7e00624ec066054b | Sgeo | 2016-02-22T05:32:23 | Update version. | diff --git a/Cargo.toml b/Cargo.toml
index 8cdb2c9..6ed6912 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,9 +1,9 @@
[package]
name = "take_mut"
-version = "0.1.1"
+version = "0.1.2"
authors = ["Sgeo <sgeoster@gmail.com>"]
license = "MIT"
homepage = "https://github.com/Sgeo/take_mut"
repository = "https://github.... | 1 | 2 | 2 |
e544f83f81be3f012208ad06a56685eaddfb9b84 | Sgeo | 2016-02-22T05:28:43 | Change status code on panic from -1 to 101 (also used by panic!() ) | diff --git a/src/exit_on_panic.rs b/src/exit_on_panic.rs
index d646006..62bbb00 100644
--- a/src/exit_on_panic.rs
+++ b/src/exit_on_panic.rs
@@ -16,7 +16,7 @@ impl ExitOnSuddenDrop {
impl Drop for ExitOnSuddenDrop {
fn drop(&mut self) {
- ::std::process::exit(-1);
+ ::std::process::exit(101);
... | 2 | 2 | 2 |
d1a613046f671af6dab97a4c9b3df611e0510a2e | Sgeo | 2016-02-15T01:03:55 | Take /u/Amanieu's suggestion to use mem::forget instead of storing state in ExitOnSuddenDrop | diff --git a/src/exit_on_panic.rs b/src/exit_on_panic.rs
index f3c9064..d646006 100644
--- a/src/exit_on_panic.rs
+++ b/src/exit_on_panic.rs
@@ -1,26 +1,22 @@
/// Used to ensure an exit on panic.
/// Call .done() to consume without exiting
#[derive(Debug)]
-struct ExitOnSuddenDrop {
- finished: bool
-}
+struct Ex... | 1 | 5 | 9 |
76a52ce94bc5335e7a2eda25effe2f9b277de7ea | Sgeo | 2016-02-14T10:17:51 | Use crates.fyi for docs. | diff --git a/Cargo.toml b/Cargo.toml
index 1eb5cbd..704c9b9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -6,4 +6,4 @@ license = "MIT"
homepage = "https://github.com/Sgeo/take_mut"
repository = "https://github.com/Sgeo/take_mut"
description = "Take a T from a &mut T temporarily"
-documentation = "http://sgeo.github.io... | 1 | 1 | 1 |
d0b88b49d6f13576d64180f7f9d1331b653e705d | Sgeo | 2016-02-14T09:47:45 | Note caveat. | diff --git a/src/lib.rs b/src/lib.rs
index eac1a15..7dd2cee 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -2,6 +2,8 @@
//!
//! `take()` allows for taking `T` out of a `&mut T`, doing anything with it including consuming it, and producing another `T` to put back in the `&mut T`.
//!
+//! During `take()`, if a panic occ... | 1 | 2 | 0 |
16786b4fa04b6adb70ae34dab380ce5acabdb7ad | Sgeo | 2016-02-14T09:45:01 | Update Cargo.toml | diff --git a/Cargo.toml b/Cargo.toml
index f099cdc..1eb5cbd 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -2,3 +2,8 @@
name = "take_mut"
version = "0.1.0"
authors = ["Sgeo <sgeoster@gmail.com>"]
+license = "MIT"
+homepage = "https://github.com/Sgeo/take_mut"
+repository = "https://github.com/Sgeo/take_mut"
+descriptio... | 1 | 5 | 0 |
8248c7033c221fc1e81f9a31b2a534c4f668aa5e | Sgeo | 2016-02-14T09:38:21 | Add crate-level documentation, and improve take() documentation. | diff --git a/src/lib.rs b/src/lib.rs
index 3df8181..eac1a15 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,11 +1,16 @@
+//! This crate provides (at this time) a single function, `take()`.
+//!
+//! `take()` allows for taking `T` out of a `&mut T`, doing anything with it including consuming it, and producing another `T`... | 1 | 10 | 4 |
0dd07914837d0932c007963c650f80dbd710c4c7 | Sgeo | 2016-02-14T09:02:20 | Add example for take_mut::take() | diff --git a/src/lib.rs b/src/lib.rs
index 2cb596f..3df8181 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -8,6 +8,17 @@ use abort_on_panic::abort_on_panic;
/// The closure must return a valid T
/// # Aborts
/// Will abort the program (exiting with status code -1) if the closure panics.
+///
+/// # Example
+/// ```
+//... | 1 | 11 | 0 |
3de23b1d5382936de76ea6ccdc5e32c5494e32b3 | Sgeo | 2016-02-14T07:40:42 | Actually test that the mutation worked. | diff --git a/src/lib.rs b/src/lib.rs
index 38e7f3f..2cb596f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -23,6 +23,7 @@ pub fn take<T, F>(mut_ref: &mut T, closure: F)
#[test]
fn it_works() {
+ #[derive(PartialEq, Eq, Debug)]
enum Foo {A, B};
impl Drop for Foo {
fn drop(&mut self) {
@@ -37,4 +38... | 1 | 2 | 0 |
3de2509f4273fdad44936e157d1288b09f8907fc | Sgeo | 2016-02-14T07:35:45 | Abstract out abort_on_panic and use it. | diff --git a/src/abort_on_panic.rs b/src/abort_on_panic.rs
index 9f51278..7b57e8e 100644
--- a/src/abort_on_panic.rs
+++ b/src/abort_on_panic.rs
@@ -19,7 +19,17 @@ impl AbortOnSuddenDrop {
impl Drop for AbortOnSuddenDrop {
fn drop(&mut self) {
if !self.finished {
- std::process::exit(-1);
+ ... | 2 | 21 | 8 |
812840608a3d6fdc441339fea2b6487faba96741 | Sgeo | 2016-02-14T07:31:37 | Begin moving abort-on-panic code. | diff --git a/src/abort_on_panic.rs b/src/abort_on_panic.rs
new file mode 100644
index 0000000..9f51278
--- /dev/null
+++ b/src/abort_on_panic.rs
@@ -0,0 +1,25 @@
+/// Used to ensure an abort on panic.
+/// Call .done() to consume without aborting
+#[derive(Debug)]
+struct AbortOnSuddenDrop {
+ finished: bool
+}
+
+i... | 2 | 25 | 26 |
88a4451d362fe8dc89bac90ddea58b1c1b24957d | Sgeo | 2016-02-14T07:29:33 | Removing scope-based take for a while, which I'm currently uncertain how to make safe. | diff --git a/src/lib.rs b/src/lib.rs
index 2709fdc..33dd516 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -43,61 +43,6 @@ pub fn take<T, F>(mut_ref: &mut T, closure: F)
aborter.done();
}
-use std::cell::Cell;
-
-pub struct Scope {
- active_holes: Cell<usize>
-}
-
-impl Scope {
- pub fn scope<F>(f: F)
- w... | 1 | 0 | 76 |
ef7c47bf6a0e66e80bfb12b553b2850c2379943f | Sgeo | 2016-01-22T06:07:00 | Switch to using std::ptr functions instead of std::mem functions per suggestions from IRC. | diff --git a/src/lib.rs b/src/lib.rs
index adfb753..2709fdc 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -33,13 +33,12 @@ impl Drop for AbortOnSuddenDrop {
/// Will abort the program (exiting with status code -1) if the closure panics.
pub fn take<T, F>(mut_ref: &mut T, closure: F)
where F: FnOnce(T) -> T {
- us... | 1 | 5 | 6 |
853e9cb914a6a9d7a368f9757e568cbaac83b1e5 | Sgeo | 2016-01-21T05:42:12 | Add test/example for Scope mechanism | diff --git a/src/lib.rs b/src/lib.rs
index f4c2843..adfb753 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -117,3 +117,24 @@ fn it_works() {
Foo::B
});
}
+
+#[test]
+fn scope_based_take() {
+ #[derive(Debug)]
+ struct Foo;
+
+ #[derive(Debug)]
+ struct Bar {
+ a: Foo,
+ b: Foo
+... | 1 | 21 | 0 |
f79c9b9c390dfd15ebba8768551a94ae7b667fb8 | Sgeo | 2016-01-21T05:35:25 | Finish writing scope-based taking code. | diff --git a/src/lib.rs b/src/lib.rs
index beb2e4e..f4c2843 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -44,23 +44,39 @@ pub fn take<T, F>(mut_ref: &mut T, closure: F)
aborter.done();
}
-use std::cell;
+use std::cell::Cell;
pub struct Scope {
- active_holes: cell::Cell<usize>
+ active_holes: Cell<usize... | 1 | 32 | 4 |
c33d49178578117f987fff9107ea1b05e0b1e500 | jam1garner | 2021-10-23T17:54:31 | Add top-level documentation to matches | diff --git a/matches/lib.rs b/matches/lib.rs
index 3bcd6e2..262f8d0 100644
--- a/matches/lib.rs
+++ b/matches/lib.rs
@@ -1,4 +1,37 @@
#![no_std]
+//! A macro to evaluate, as a boolean, whether an expression matches a pattern.
+//!
+//! For users who build using only Rust 1.42 and newer, consider using [`std::matches`]... | 1 | 33 | 0 |
4ddd8f6fd76218b37a56b6036e46468521283474 | Simon Sapin | 2021-10-02T09:55:21 | Add test case with wildcard import
CC https://github.com/SimonSapin/rust-std-candidates/issues/22
Fixes https://github.com/SimonSapin/rust-std-candidates/issues/24 | diff --git a/matches/tests/use_star.rs b/matches/tests/use_star.rs
new file mode 100644
index 0000000..58a670b
--- /dev/null
+++ b/matches/tests/use_star.rs
@@ -0,0 +1,10 @@
+//! https://github.com/SimonSapin/rust-std-candidates/issues/22
+
+extern crate matches;
+
+use matches::*;
+
+#[test]
+fn test_assert_matches() ... | 1 | 10 | 0 |
45835324811728ef2ae79984714c4bb4a5f590bc | Mads Marquart | 2021-08-12T16:46:25 | Bump matches to 0.1.9 | diff --git a/matches/Cargo.toml b/matches/Cargo.toml
index afc7422..bf12269 100644
--- a/matches/Cargo.toml
+++ b/matches/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "matches"
-version = "0.1.8"
+version = "0.1.9"
authors = ["Simon Sapin <simon.sapin@exyr.org>"]
license = "MIT"
repository = "https://github.com/Sim... | 1 | 1 | 1 |
ef4a0c7f9eb578be14c50bcda6d3e8716b4c6c6b | Mads Marquart | 2021-08-12T15:23:20 | Make matches crate no_std compatible
I wanted to make the [`url`](https://github.com/servo/rust-url) crate `no_std` compatible, but since their MSRV is 1.36, they still use this crate, and hence is blocked here.
Another option is to not do this and just wait until `url` updates their MSRV, or remove usage of the `m... | diff --git a/matches/lib.rs b/matches/lib.rs
index b183925..3bcd6e2 100644
--- a/matches/lib.rs
+++ b/matches/lib.rs
@@ -1,3 +1,5 @@
+#![no_std]
+
/// Check if an expression matches a refutable pattern.
///
/// Syntax: `matches!(` *expression* `,` *pattern* `)` | 1 | 2 | 0 |
4d38151012381e2edae0cc4fd798e14649a0b909 | Simon Sapin | 2018-08-22T17:19:22 | Remove incorrect use of local_inner_macros, fix #15 | diff --git a/matches/Cargo.toml b/matches/Cargo.toml
index c26883d..afc7422 100644
--- a/matches/Cargo.toml
+++ b/matches/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "matches"
-version = "0.1.7"
+version = "0.1.8"
authors = ["Simon Sapin <simon.sapin@exyr.org>"]
license = "MIT"
repository = "https://github.com/Sim... | 2 | 12 | 5 |
2bf3a13d078b1e863ac1fee5ada7a2e1b45f0149 | Simon Sapin | 2018-08-22T17:17:44 | Fix #12 with a test | diff --git a/matches/tests/macro_use_one.rs b/matches/tests/macro_use_one.rs
new file mode 100644
index 0000000..a527a89
--- /dev/null
+++ b/matches/tests/macro_use_one.rs
@@ -0,0 +1,11 @@
+// https://github.com/SimonSapin/rust-std-candidates/issues/12
+#[macro_use(matches)] extern crate matches;
+
+#[test]
+fn matches... | 1 | 11 | 0 |
20654d580aa6521e66a0c3dd9182531636d48321 | Simon Sapin | 2018-08-22T12:28:13 | Make tests pass on Rust 1.18 and older | diff --git a/zip_longest/lib.rs b/zip_longest/lib.rs
index bedc120..c59e0cf 100644
--- a/zip_longest/lib.rs
+++ b/zip_longest/lib.rs
@@ -106,7 +106,7 @@ pub enum EitherOrBoth<A, B> {
fn test_iterator_size_hint() {
use std::usize;
- let c = 0i32..;
+ let c = std::iter::repeat(0);
let v: &[_] = &[0i32,... | 1 | 1 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.