pub struct StyledText<'a> { /* private fields */ }Expand description
A wrapper for text with an associated style label, for diagnostics or formatting.
StyledText is a simple struct that pairs a style name (such as "error", "info", etc.)
with a text value. It is useful for tagging text with semantic meaning for later formatting,
such as coloring or styling in diagnostics or logs.
The Debug implementation prints the text wrapped in XML-like tags using the style name.
§Examples
use text_fx::style::StyledText;
let styled = StyledText::new("warning", "be careful!");
assert_eq!(format!("{:?}", styled), "<warning>be careful!</warning>");Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for StyledText<'a>
impl<'a> RefUnwindSafe for StyledText<'a>
impl<'a> Send for StyledText<'a>
impl<'a> Sync for StyledText<'a>
impl<'a> Unpin for StyledText<'a>
impl<'a> UnwindSafe for StyledText<'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