Struct text_style::StyledStr [−][src]
Expand description
A borrowed string with an optional style annotation.
Example
let s = text_style::StyledStr::plain("test").bold(); let s1 = text_style::StyledStr::styled("test", text_style::Style::fg(text_style::AnsiColor::Red.dark())); let s2 = text_style::StyledStr::plain("test").with(text_style::AnsiColor::Red.dark()); assert_eq!(s1, s2);
Fields
s: &'a str
The content of this string.
style: Option<Style>
The style of this string.
Implementations
Creates a new styled string from the given string and an optional style.
Creates a new styled string from the given string and style.
Creates a new styled string from the given string without a style.
Sets the strikethrough effect for this styled string.
Trait Implementations
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Convert this string into a TermionStr
that can be formatted with termion
. Read more
Auto Trait Implementations
impl<'a> RefUnwindSafe for StyledStr<'a>
impl<'a> UnwindSafe for StyledStr<'a>
Blanket Implementations
Mutably borrows from an owned value. Read more
Calls the given closure and return the result. Read more
Calls the given closure on self
.