pub struct StyledText<'a> { /* private fields */ }
Expand description
Represents a piece of text with optional color and formatting.
Implementations§
Source§impl<'a> StyledText<'a>
impl<'a> StyledText<'a>
Sourcepub fn bold(self) -> Self
pub fn bold(self) -> Self
Enables bold formatting for the text.
§Returns
The modified StyledText
instance with bold formatting applied.
Sourcepub fn italic(self) -> Self
pub fn italic(self) -> Self
Enables italic formatting for the text.
§Returns
The modified StyledText
instance with italic formatting applied.
Sourcepub fn underline(self) -> Self
pub fn underline(self) -> Self
Enables underline formatting for the text.
§Returns
The modified StyledText
instance with underline formatting applied.
Sourcepub fn reverse(self) -> Self
pub fn reverse(self) -> Self
Enables reverse video (inverts foreground and background colors).
§Returns
The modified StyledText
instance with inverted colors.
Sourcepub fn strikethrough(self) -> Self
pub fn strikethrough(self) -> Self
Enables strikethrough formatting for the text.
§Returns
The modified StyledText
instance with strikethrough applied.
Sourcepub fn format_sequence(&'a self) -> String
pub fn format_sequence(&'a self) -> String
Converts the colored text into a formatted ANSI escape sequence string.
§Returns
A String
containing the ANSI-formatted text.
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