Struct erg_common::style::StyledString
source · pub struct StyledString { /* private fields */ }
Expand description
StyledString
is for coloring and attribute text.
String, Color(&str) and Attribute(&str)
Implementations
sourceimpl StyledString
impl StyledString
pub fn new(s: &str, color: Option<Color>, attribute: Option<Attribute>) -> Self
sourcepub fn push_str(&mut self, s: &str)
pub fn push_str(&mut self, s: &str)
Methods for pushing additional &str for strings that already have attributes or colors.
Example
let mut text = StyledString::new("sample text", None, Some(Attribute::Underline));
text.push_str("\n");
text.push_str("Next break line text");
println!("{text}"); // Two lines of text underlined are displayed
Trait Implementations
sourceimpl Debug for StyledString
impl Debug for StyledString
Auto Trait Implementations
impl RefUnwindSafe for StyledString
impl Send for StyledString
impl Sync for StyledString
impl Unpin for StyledString
impl UnwindSafe for StyledString
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more