pub struct MarkdownFiles(/* private fields */);Methods from Deref<Target = HashMap<PathBuf, MarkdownInfo>>§
Sourcepub fn pin(&self) -> HashMapRef<'_, K, V, S, LocalGuard<'_>>
pub fn pin(&self) -> HashMapRef<'_, K, V, S, LocalGuard<'_>>
Returns a pinned reference to the map.
The returned reference manages a guard internally, preventing garbage collection for as long as it is held. See the crate-level documentation for details.
Sourcepub fn pin_owned(&self) -> HashMapRef<'_, K, V, S, OwnedGuard<'_>>
pub fn pin_owned(&self) -> HashMapRef<'_, K, V, S, OwnedGuard<'_>>
Returns a pinned reference to the map.
Unlike HashMap::pin, the returned reference implements Send and Sync,
allowing it to be held across .await points in work-stealing schedulers.
This is especially useful for iterators.
The returned reference manages a guard internally, preventing garbage collection for as long as it is held. See the crate-level documentation for details.
Sourcepub fn guard(&self) -> LocalGuard<'_>
pub fn guard(&self) -> LocalGuard<'_>
Returns a guard for use with this map.
Note that holding on to a guard prevents garbage collection. See the crate-level documentation for details.
Sourcepub fn owned_guard(&self) -> OwnedGuard<'_>
pub fn owned_guard(&self) -> OwnedGuard<'_>
Returns an owned guard for use with this map.
Owned guards implement Send and Sync, allowing them to be held across
.await points in work-stealing schedulers. This is especially useful
for iterators.
Note that holding on to a guard prevents garbage collection. See the crate-level documentation for details.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of entries in the map.
§Examples
use papaya::HashMap;
let map = HashMap::new();
map.pin().insert(1, "a");
map.pin().insert(2, "b");
assert!(map.len() == 2);Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if the map is empty. Otherwise returns false.
§Examples
use papaya::HashMap;
let map = HashMap::new();
assert!(map.is_empty());
map.pin().insert("a", 1);
assert!(!map.is_empty());Sourcepub fn contains_key<Q>(&self, key: &Q, guard: &impl Guard) -> bool
pub fn contains_key<Q>(&self, key: &Q, guard: &impl Guard) -> bool
Returns true if the map contains a value for the specified key.
The key may be any borrowed form of the map’s key type, but
Hash and Eq on the borrowed form must match those for
the key type.
§Examples
use papaya::HashMap;
let map = HashMap::new();
map.pin().insert(1, "a");
assert_eq!(map.pin().contains_key(&1), true);
assert_eq!(map.pin().contains_key(&2), false);Sourcepub fn get<'g, Q>(&self, key: &Q, guard: &'g impl Guard) -> Option<&'g V>
pub fn get<'g, Q>(&self, key: &Q, guard: &'g impl Guard) -> Option<&'g V>
Returns a reference to the value corresponding to the key.
The key may be any borrowed form of the map’s key type, but
Hash and Eq on the borrowed form must match those for
the key type.
§Examples
use papaya::HashMap;
let map = HashMap::new();
map.pin().insert(1, "a");
assert_eq!(map.pin().get(&1), Some(&"a"));
assert_eq!(map.pin().get(&2), None);Sourcepub fn get_key_value<'g, Q>(
&self,
key: &Q,
guard: &'g impl Guard,
) -> Option<(&'g K, &'g V)>
pub fn get_key_value<'g, Q>( &self, key: &Q, guard: &'g impl Guard, ) -> Option<(&'g K, &'g V)>
Returns the key-value pair corresponding to the supplied key.
The supplied key may be any borrowed form of the map’s key type, but
Hash and Eq on the borrowed form must match those for
the key type.
§Examples
use papaya::HashMap;
let map = HashMap::new();
map.pin().insert(1, "a");
assert_eq!(map.pin().get_key_value(&1), Some((&1, &"a")));
assert_eq!(map.pin().get_key_value(&2), None);Sourcepub fn insert<'g>(
&self,
key: K,
value: V,
guard: &'g impl Guard,
) -> Option<&'g V>
pub fn insert<'g>( &self, key: K, value: V, guard: &'g impl Guard, ) -> Option<&'g V>
Inserts a key-value pair into the map.
If the map did not have this key present, None is returned.
If the map did have this key present, the value is updated, and the old
value is returned. The key is not updated, though; this matters for
types that can be == without being identical. See the standard library
documentation for details.
§Examples
use papaya::HashMap;
let map = HashMap::new();
assert_eq!(map.pin().insert(37, "a"), None);
assert_eq!(map.pin().is_empty(), false);
map.pin().insert(37, "b");
assert_eq!(map.pin().insert(37, "c"), Some(&"b"));
assert_eq!(map.pin().get(&37), Some(&"c"));Sourcepub fn try_insert<'g>(
&self,
key: K,
value: V,
guard: &'g impl Guard,
) -> Result<&'g V, OccupiedError<'g, V>>
pub fn try_insert<'g>( &self, key: K, value: V, guard: &'g impl Guard, ) -> Result<&'g V, OccupiedError<'g, V>>
Tries to insert a key-value pair into the map, and returns a reference to the value that was inserted.
If the map already had this key present, nothing is updated, and an error containing the existing value is returned.
§Examples
use papaya::HashMap;
let map = HashMap::new();
let map = map.pin();
assert_eq!(map.try_insert(37, "a").unwrap(), &"a");
let err = map.try_insert(37, "b").unwrap_err();
assert_eq!(err.current, &"a");
assert_eq!(err.not_inserted, "b");Sourcepub fn try_insert_with<'g, F>(
&self,
key: K,
f: F,
guard: &'g impl Guard,
) -> Result<&'g V, &'g V>where
F: FnOnce() -> V,
K: 'g,
pub fn try_insert_with<'g, F>(
&self,
key: K,
f: F,
guard: &'g impl Guard,
) -> Result<&'g V, &'g V>where
F: FnOnce() -> V,
K: 'g,
Tries to insert a key and value computed from a closure into the map, and returns a reference to the value that was inserted.
If the map already had this key present, nothing is updated, and the existing value is returned.
§Examples
use papaya::HashMap;
let map = HashMap::new();
let map = map.pin();
assert_eq!(map.try_insert_with(37, || "a").unwrap(), &"a");
let current = map.try_insert_with(37, || "b").unwrap_err();
assert_eq!(current, &"a");Sourcepub fn get_or_insert<'g>(
&self,
key: K,
value: V,
guard: &'g impl Guard,
) -> &'g V
pub fn get_or_insert<'g>( &self, key: K, value: V, guard: &'g impl Guard, ) -> &'g V
Returns a reference to the value corresponding to the key, or inserts a default value.
If the given key is present, the corresponding value is returned. If it is not present,
the provided value is inserted, and a reference to the newly inserted value is returned.
§Examples
use papaya::HashMap;
let map = HashMap::new();
assert_eq!(map.pin().get_or_insert("a", 3), &3);
assert_eq!(map.pin().get_or_insert("a", 6), &3);Sourcepub fn get_or_insert_with<'g, F>(
&self,
key: K,
f: F,
guard: &'g impl Guard,
) -> &'g Vwhere
F: FnOnce() -> V,
K: 'g,
pub fn get_or_insert_with<'g, F>(
&self,
key: K,
f: F,
guard: &'g impl Guard,
) -> &'g Vwhere
F: FnOnce() -> V,
K: 'g,
Returns a reference to the value corresponding to the key, or inserts a default value computed from a closure.
If the given key is present, the corresponding value is returned. If it is not present,
the value computed from f is inserted, and a reference to the newly inserted value is
returned.
§Examples
use papaya::HashMap;
let map = HashMap::new();
assert_eq!(map.pin().get_or_insert_with("a", || 3), &3);
assert_eq!(map.pin().get_or_insert_with("a", || 6), &3);Sourcepub fn update<'g, F>(
&self,
key: K,
update: F,
guard: &'g impl Guard,
) -> Option<&'g V>
pub fn update<'g, F>( &self, key: K, update: F, guard: &'g impl Guard, ) -> Option<&'g V>
Updates an existing entry atomically.
If the value for the specified key is present, the new value is computed and stored the
using the provided update function, and the new value is returned. Otherwise, None
is returned.
The update function is given the current value associated with the given key and returns the new value to be stored. The operation is applied atomically only if the state of the entry remains the same, meaning that it is not concurrently modified in any way. If the entry is modified, the operation is retried with the new entry, similar to a traditional compare-and-swap operation.
Note that the update function should be pure as it may be called multiple times, and the output
for a given entry may be memoized across retries.
§Examples
use papaya::HashMap;
let map = HashMap::new();
map.pin().insert("a", 1);
assert_eq!(map.pin().get(&"a"), Some(&1));
map.pin().update("a", |v| v + 1);
assert_eq!(map.pin().get(&"a"), Some(&2));Sourcepub fn update_or_insert<'g, F>(
&self,
key: K,
update: F,
value: V,
guard: &'g impl Guard,
) -> &'g V
pub fn update_or_insert<'g, F>( &self, key: K, update: F, value: V, guard: &'g impl Guard, ) -> &'g V
Updates an existing entry or inserts a default value.
If the value for the specified key is present, the new value is computed and stored the
using the provided update function, and the new value is returned. Otherwise, the provided
value is inserted into the map, and a reference to the newly inserted value is returned.
See HashMap::update for details about how atomic updates are performed.
§Examples
use papaya::HashMap;
let map = HashMap::new();
assert_eq!(*map.pin().update_or_insert("a", |i| i + 1, 0), 0);
assert_eq!(*map.pin().update_or_insert("a", |i| i + 1, 0), 1);Sourcepub fn update_or_insert_with<'g, U, F>(
&self,
key: K,
update: U,
f: F,
guard: &'g impl Guard,
) -> &'g V
pub fn update_or_insert_with<'g, U, F>( &self, key: K, update: U, f: F, guard: &'g impl Guard, ) -> &'g V
Updates an existing entry or inserts a default value computed from a closure.
If the value for the specified key is present, the new value is computed and stored the
using the provided update function, and the new value is returned. Otherwise, the value
computed by f is inserted into the map, and a reference to the newly inserted value is
returned.
See HashMap::update for details about how atomic updates are performed.
§Examples
use papaya::HashMap;
let map = HashMap::new();
assert_eq!(*map.pin().update_or_insert_with("a", |i| i + 1, || 0), 0);
assert_eq!(*map.pin().update_or_insert_with("a", |i| i + 1, || 0), 1);Sourcepub fn compute<'g, F, T>(
&self,
key: K,
compute: F,
guard: &'g impl Guard,
) -> Compute<'g, K, V, T>
pub fn compute<'g, F, T>( &self, key: K, compute: F, guard: &'g impl Guard, ) -> Compute<'g, K, V, T>
Updates an entry with a compare-and-swap (CAS) function.
This method allows you to perform complex operations on the map atomically. The compute
closure is given the current state of the entry and returns the operation that should be
performed. The operation is applied atomically only if the state of the entry remains the same,
meaning it is not concurrently modified in any way.
Note that the compute function should be pure as it may be called multiple times, and
the output for a given entry may be memoized across retries.
In most cases you can avoid this method and instead use a higher-level atomic operation. See the crate-level documentation for details.
§Examples
use papaya::{HashMap, Operation, Compute};
let map = HashMap::new();
let map = map.pin();
let compute = |entry| match entry {
// Remove the value if it is even.
Some((_key, value)) if value % 2 == 0 => {
Operation::Remove
}
// Increment the value if it is odd.
Some((_key, value)) => {
Operation::Insert(value + 1)
}
// Do nothing if the key does not exist
None => Operation::Abort(()),
};
assert_eq!(map.compute('A', compute), Compute::Aborted(()));
map.insert('A', 1);
assert_eq!(map.compute('A', compute), Compute::Updated {
old: (&'A', &1),
new: (&'A', &2),
});
assert_eq!(map.compute('A', compute), Compute::Removed(&'A', &2));Sourcepub fn remove<'g, Q>(&self, key: &Q, guard: &'g impl Guard) -> Option<&'g V>
pub fn remove<'g, Q>(&self, key: &Q, guard: &'g impl Guard) -> Option<&'g V>
Removes a key from the map, returning the value at the key if the key was previously in the map.
The key may be any borrowed form of the map’s key type, but
Hash and Eq on the borrowed form must match those for
the key type.
§Examples
use papaya::HashMap;
let map = HashMap::new();
map.pin().insert(1, "a");
assert_eq!(map.pin().remove(&1), Some(&"a"));
assert_eq!(map.pin().remove(&1), None);Sourcepub fn remove_entry<'g, Q>(
&self,
key: &Q,
guard: &'g impl Guard,
) -> Option<(&'g K, &'g V)>
pub fn remove_entry<'g, Q>( &self, key: &Q, guard: &'g impl Guard, ) -> Option<(&'g K, &'g V)>
Removes a key from the map, returning the stored key and value if the key was previously in the map.
The key may be any borrowed form of the map’s key type, but
Hash and Eq on the borrowed form must match those for
the key type.
§Examples
use papaya::HashMap;
let map = HashMap::new();
map.pin().insert(1, "a");
assert_eq!(map.pin().get(&1), Some(&"a"));
assert_eq!(map.pin().remove_entry(&1), Some((&1, &"a")));
assert_eq!(map.pin().remove(&1), None);Sourcepub fn remove_if<'g, Q, F>(
&self,
key: &Q,
should_remove: F,
guard: &'g impl Guard,
) -> Result<Option<(&'g K, &'g V)>, (&'g K, &'g V)>
pub fn remove_if<'g, Q, F>( &self, key: &Q, should_remove: F, guard: &'g impl Guard, ) -> Result<Option<(&'g K, &'g V)>, (&'g K, &'g V)>
Conditionally removes a key from the map based on the provided closure.
If the key is found in the map and the closure returns true given the key and its value,
the key and value are returned successfully. Note that the returned entry is guaranteed to
be the same entry that the closure returned true for. However, the closure returning true
does not guarantee that the entry is removed in the presence of concurrent modifications.
If the key is not found in the map, Ok(None) is returned.
If the closure returns false, an error is returned containing the entry provided to the closure.
§Examples
use papaya::HashMap;
let map = HashMap::new();
map.pin().insert(1, "a");
assert_eq!(map.pin().remove_if(&1, |k, v| *v == "b"), Err((&1, &"a")));
assert_eq!(map.pin().get(&1), Some(&"a"));
assert_eq!(map.pin().remove_if(&1, |k, v| *v == "a"), Ok(Some((&1, &"a"))));
assert_eq!(map.pin().remove_if(&1, |_, _| true), Ok(None));Sourcepub fn reserve(&self, additional: usize, guard: &impl Guard)
pub fn reserve(&self, additional: usize, guard: &impl Guard)
Tries to reserve capacity for additional more elements to be inserted
in the HashMap.
After calling this method, the table should be able to hold at least capacity elements
before resizing. However, the capacity is an estimate, and the table may prematurely resize
due to poor hash distribution. The collection may also reserve more space to avoid frequent
reallocations.
§Panics
Panics if the new allocation size overflows usize.
§Examples
use papaya::HashMap;
let map: HashMap<&str, i32> = HashMap::new();
map.pin().reserve(10);Sourcepub fn clear(&self, guard: &impl Guard)
pub fn clear(&self, guard: &impl Guard)
Clears the map, removing all key-value pairs.
Note that this method will block until any in-progress resizes are completed before proceeding. See the consistency section for details.
§Examples
use papaya::HashMap;
let map = HashMap::new();
map.pin().insert(1, "a");
map.pin().clear();
assert!(map.pin().is_empty());Sourcepub fn retain<F>(&self, f: F, guard: &impl Guard)
pub fn retain<F>(&self, f: F, guard: &impl Guard)
Retains only the elements specified by the predicate.
In other words, remove all pairs (k, v) for which f(&k, &v) returns false.
The elements are visited in unsorted (and unspecified) order.
Note the function may be called more than once for a given key if its value is concurrently modified during removal.
Additionally, this method will block until any in-progress resizes are completed before proceeding. See the consistency section for details.
§Examples
use papaya::HashMap;
let mut map: HashMap<i32, i32> = (0..8).map(|x| (x, x * 10)).collect();
map.pin().retain(|&k, _| k % 2 == 0);
assert_eq!(map.len(), 4);Sourcepub fn iter<'g, G>(&self, guard: &'g G) -> Iter<'g, K, V, G> ⓘwhere
G: Guard,
pub fn iter<'g, G>(&self, guard: &'g G) -> Iter<'g, K, V, G> ⓘwhere
G: Guard,
An iterator visiting all key-value pairs in arbitrary order.
The iterator element type is (&K, &V).
Note that this method will block until any in-progress resizes are completed before proceeding. See the consistency section for details.
§Examples
use papaya::HashMap;
let map = HashMap::from([
("a", 1),
("b", 2),
("c", 3),
]);
for (key, val) in map.pin().iter() {
println!("key: {key} val: {val}");
}Sourcepub fn keys<'g, G>(&self, guard: &'g G) -> Keys<'g, K, V, G> ⓘwhere
G: Guard,
pub fn keys<'g, G>(&self, guard: &'g G) -> Keys<'g, K, V, G> ⓘwhere
G: Guard,
An iterator visiting all keys in arbitrary order.
The iterator element type is &K.
Note that this method will block until any in-progress resizes are completed before proceeding. See the consistency section for details.
§Examples
use papaya::HashMap;
let map = HashMap::from([
("a", 1),
("b", 2),
("c", 3),
]);
for key in map.pin().keys() {
println!("{key}");
}Sourcepub fn values<'g, G>(&self, guard: &'g G) -> Values<'g, K, V, G> ⓘwhere
G: Guard,
pub fn values<'g, G>(&self, guard: &'g G) -> Values<'g, K, V, G> ⓘwhere
G: Guard,
An iterator visiting all values in arbitrary order.
The iterator element type is &V.
Note that this method will block until any in-progress resizes are completed before proceeding. See the consistency section for details.
§Examples
use papaya::HashMap;
let map = HashMap::from([
("a", 1),
("b", 2),
("c", 3),
]);
for value in map.pin().values() {
println!("{value}");
}Trait Implementations§
Source§impl Clone for MarkdownFiles
impl Clone for MarkdownFiles
Source§impl Deref for MarkdownFiles
impl Deref for MarkdownFiles
Source§impl Serialize for MarkdownFiles
Serializes in url_path order rather than map order.
impl Serialize for MarkdownFiles
Serializes in url_path order rather than map order.
papaya::HashMap uses a randomly seeded RandomState, so iteration order
differs between processes: two builds of the same repository produced
byte-different site.json/media.json, which churns committed build/
directories and invalidates content-hash/ETag caches on a no-op rebuild.
raw_path breaks ties, because distinct files can share a url_path
(docs/index.md and docs.md both render at /docs/).
Auto Trait Implementations§
impl !Freeze for MarkdownFiles
impl RefUnwindSafe for MarkdownFiles
impl Send for MarkdownFiles
impl Sync for MarkdownFiles
impl Unpin for MarkdownFiles
impl UnsafeUnpin for MarkdownFiles
impl UnwindSafe for MarkdownFiles
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);