pub struct MappingAny(/* private fields */);Expand description
A YAML mapping with Value keys.
Unlike Mapping which only supports String keys, MappingAny allows
any Value as a key. This is useful for representing YAML mappings where
keys might be numbers, booleans, or even nested structures.
§Examples
use noyalib::{MappingAny, Value};
let mut map = MappingAny::new();
map.insert(Value::from(1), Value::from("one"));
map.insert(Value::from("two"), Value::from(2));
map.insert(Value::Bool(true), Value::from("yes"));
assert_eq!(map.len(), 3);
assert_eq!(map.get(&Value::from(1)).unwrap().as_str(), Some("one"));§YAML Example
This type can represent YAML like:
1: one
"two": 2
true: yes
[1, 2]: nested keyImplementations§
Source§impl MappingAny
impl MappingAny
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates an empty mapping with the specified capacity.
Sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Returns the number of key-value pairs the mapping can hold without reallocating.
Sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Reserves capacity for at least additional more key-value pairs.
Sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Shrinks the capacity of the mapping as much as possible.
Sourcepub fn insert(&mut self, key: Value, value: Value) -> Option<Value>
pub fn insert(&mut self, key: Value, value: Value) -> Option<Value>
Inserts a key-value pair into the mapping.
If the mapping already had this key present, the value is updated, and the old value is returned.
Sourcepub fn contains_key(&self, key: &Value) -> bool
pub fn contains_key(&self, key: &Value) -> bool
Returns true if the mapping contains the specified key.
Sourcepub fn get(&self, key: &Value) -> Option<&Value>
pub fn get(&self, key: &Value) -> Option<&Value>
Returns a reference to the value corresponding to the key.
Sourcepub fn get_mut(&mut self, key: &Value) -> Option<&mut Value>
pub fn get_mut(&mut self, key: &Value) -> Option<&mut Value>
Returns a mutable reference to the value corresponding to the key.
Sourcepub fn get_index(&self, index: usize) -> Option<(&Value, &Value)>
pub fn get_index(&self, index: usize) -> Option<(&Value, &Value)>
Returns a reference to the key-value pair at the given index.
Sourcepub fn get_index_mut(&mut self, index: usize) -> Option<(&Value, &mut Value)>
pub fn get_index_mut(&mut self, index: usize) -> Option<(&Value, &mut Value)>
Returns a mutable reference to the key-value pair at the given index.
Sourcepub fn remove(&mut self, key: &Value) -> Option<Value>
pub fn remove(&mut self, key: &Value) -> Option<Value>
Removes a key from the mapping, returning the value if the key was present.
This operation preserves the order of remaining elements.
Sourcepub fn remove_entry(&mut self, key: &Value) -> Option<(Value, Value)>
pub fn remove_entry(&mut self, key: &Value) -> Option<(Value, Value)>
Removes a key from the mapping, returning the key-value pair if present.
This operation preserves the order of remaining elements.
Sourcepub fn swap_remove(&mut self, key: &Value) -> Option<Value>
pub fn swap_remove(&mut self, key: &Value) -> Option<Value>
Removes a key by swapping it with the last element.
This is faster than remove but does not preserve order.
Sourcepub fn shift_remove(&mut self, key: &Value) -> Option<Value>
pub fn shift_remove(&mut self, key: &Value) -> Option<Value>
Removes a key by shifting all elements after it.
This preserves order but is slower than swap_remove.
Sourcepub fn entry(&mut self, key: Value) -> Entry<'_, Value, Value>
pub fn entry(&mut self, key: Value) -> Entry<'_, Value, Value>
Gets the entry for the given key for in-place manipulation.
Sourcepub fn iter_mut(&mut self) -> IterMut<'_, Value, Value> ⓘ
pub fn iter_mut(&mut self) -> IterMut<'_, Value, Value> ⓘ
Returns a mutable iterator over the key-value pairs.
Sourcepub fn values_mut(&mut self) -> ValuesMut<'_, Value, Value> ⓘ
pub fn values_mut(&mut self) -> ValuesMut<'_, Value, Value> ⓘ
Returns a mutable iterator over the values.
Sourcepub fn first_mut(&mut self) -> Option<(&Value, &mut Value)>
pub fn first_mut(&mut self) -> Option<(&Value, &mut Value)>
Returns a mutable reference to the first key-value pair.
Sourcepub fn last_mut(&mut self) -> Option<(&Value, &mut Value)>
pub fn last_mut(&mut self) -> Option<(&Value, &mut Value)>
Returns a mutable reference to the last key-value pair.
Sourcepub fn pop_first(&mut self) -> Option<(Value, Value)>
pub fn pop_first(&mut self) -> Option<(Value, Value)>
Removes and returns the first key-value pair.
Sourcepub fn pop_last(&mut self) -> Option<(Value, Value)>
pub fn pop_last(&mut self) -> Option<(Value, Value)>
Removes and returns the last key-value pair.
Sourcepub fn into_inner(self) -> IndexMap<Value, Value>
pub fn into_inner(self) -> IndexMap<Value, Value>
Returns the inner IndexMap.
Sourcepub fn from_inner(map: IndexMap<Value, Value>) -> Self
pub fn from_inner(map: IndexMap<Value, Value>) -> Self
Creates a mapping from an IndexMap.
Sourcepub fn into_mapping(self) -> Option<Mapping>
pub fn into_mapping(self) -> Option<Mapping>
Converts this MappingAny to a Mapping if all keys are strings.
Returns None if any key is not a string value.
§Examples
use noyalib::{Mapping, MappingAny, Value};
let mut map = MappingAny::new();
map.insert(Value::from("key1"), Value::from(1));
map.insert(Value::from("key2"), Value::from(2));
let mapping = map.into_mapping().unwrap();
assert_eq!(mapping.len(), 2);Trait Implementations§
Source§impl Clone for MappingAny
impl Clone for MappingAny
Source§fn clone(&self) -> MappingAny
fn clone(&self) -> MappingAny
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MappingAny
impl Debug for MappingAny
Source§impl Default for MappingAny
impl Default for MappingAny
Source§fn default() -> MappingAny
fn default() -> MappingAny
Source§impl<'de> Deserialize<'de> for MappingAny
impl<'de> Deserialize<'de> for MappingAny
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl Display for MappingAny
impl Display for MappingAny
impl Eq for MappingAny
Source§impl From<IndexMap<Value, Value, FxBuildHasher>> for MappingAny
impl From<IndexMap<Value, Value, FxBuildHasher>> for MappingAny
Source§impl From<Mapping> for MappingAny
impl From<Mapping> for MappingAny
Source§impl From<MappingAny> for IndexMap<Value, Value>
Available on crate feature std only.
impl From<MappingAny> for IndexMap<Value, Value>
std only.Source§fn from(map: MappingAny) -> Self
fn from(map: MappingAny) -> Self
Source§impl From<MappingAny> for IndexMap<Value, Value, FxBuildHasher>
impl From<MappingAny> for IndexMap<Value, Value, FxBuildHasher>
Source§fn from(map: MappingAny) -> Self
fn from(map: MappingAny) -> Self
Source§impl FromIterator<(Value, Value)> for MappingAny
impl FromIterator<(Value, Value)> for MappingAny
Source§impl Hash for MappingAny
impl Hash for MappingAny
Source§impl Index<&Value> for MappingAny
impl Index<&Value> for MappingAny
Source§impl IndexMut<&Value> for MappingAny
impl IndexMut<&Value> for MappingAny
Source§impl IntoIterator for MappingAny
impl IntoIterator for MappingAny
Source§impl<'a> IntoIterator for &'a MappingAny
impl<'a> IntoIterator for &'a MappingAny
Source§impl<'a> IntoIterator for &'a mut MappingAny
impl<'a> IntoIterator for &'a mut MappingAny
Source§impl Ord for MappingAny
impl Ord for MappingAny
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for MappingAny
impl PartialEq for MappingAny
Source§impl PartialOrd for MappingAny
impl PartialOrd for MappingAny
Source§impl Serialize for MappingAny
impl Serialize for MappingAny
impl StructuralPartialEq for MappingAny
Source§impl Value for MappingAny
Available on crate feature sval only.
impl Value for MappingAny
sval only.Source§fn stream<'sval, S: Stream<'sval> + ?Sized>(
&'sval self,
stream: &mut S,
) -> Result
fn stream<'sval, S: Stream<'sval> + ?Sized>( &'sval self, stream: &mut S, ) -> Result
Stream.Source§fn to_f32(&self) -> Option<f32>
fn to_f32(&self) -> Option<f32>
Auto Trait Implementations§
impl Freeze for MappingAny
impl RefUnwindSafe for MappingAny
impl Send for MappingAny
impl Sync for MappingAny
impl Unpin for MappingAny
impl UnsafeUnpin for MappingAny
impl UnwindSafe for MappingAny
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
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, O> Matches<O> for Twhere
T: PartialEq<O>,
impl<T, O> Matches<O> for Twhere
T: PartialEq<O>,
fn validate_matches(&self, other: &O) -> bool
impl<T> MaybeSendSync for T
Source§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read moreSource§fn fg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
Source§fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
Source§fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
Source§fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
Source§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);Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more