pub struct RichStyle<'a>(pub &'a Style);Expand description
Wrapper for a [Style] that allows to represent it in rich syntax.
§Examples
use anstyle::{Style, Effects, AnsiColor};
use styled_str::RichStyle;
let style = RichStyle::parse("bold, ul red! on white", &Style::new())?;
assert_eq!(style.get_effects(), Effects::BOLD | Effects::UNDERLINE);
assert_eq!(style.get_fg_color(), Some(AnsiColor::BrightRed.into()));
assert_eq!(style.get_bg_color(), Some(AnsiColor::White.into()));
let canonical_str = RichStyle(&style).to_string();
assert_eq!(canonical_str, "bold underline red! on white");Tuple Fields§
§0: &'a StyleImplementations§
Trait Implementations§
impl<'a> Copy for RichStyle<'a>
Auto Trait Implementations§
impl<'a> Freeze for RichStyle<'a>
impl<'a> RefUnwindSafe for RichStyle<'a>
impl<'a> Send for RichStyle<'a>
impl<'a> Sync for RichStyle<'a>
impl<'a> Unpin for RichStyle<'a>
impl<'a> UnwindSafe for RichStyle<'a>
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
Mutably borrows from an owned value. Read more