pub struct StyledString { /* private fields */ }Expand description
A styled string that preserves styling context like colored’s ColoredString
This type automatically handles reset sequences to ensure that when styled strings are embedded within other styled strings, the outer styling context is properly preserved.
Implementations§
Trait Implementations§
Source§impl AsRef<str> for StyledString
impl AsRef<str> for StyledString
Source§impl Clone for StyledString
impl Clone for StyledString
Source§fn clone(&self) -> StyledString
fn clone(&self) -> StyledString
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StyledString
impl Debug for StyledString
Source§impl Display for StyledString
impl Display for StyledString
Source§impl From<StyledString> for String
impl From<StyledString> for String
Source§fn from(styled: StyledString) -> Self
fn from(styled: StyledString) -> Self
Converts to this type from the input type.
Source§impl StyledPrint for StyledString
impl StyledPrint for StyledString
Source§impl Styler for StyledString
impl Styler for StyledString
Source§fn vprtln(&self, verbosity: Verbosity, args: Arguments<'_>)
fn vprtln(&self, verbosity: Verbosity, args: Arguments<'_>)
Print a styled line with verbosity gating using this style Read more
Source§fn paint<D>(&self, val: D) -> Stringwhere
D: Display,
fn paint<D>(&self, val: D) -> Stringwhere
D: Display,
Apply this style to text and return the styled string Read more
Source§fn bold(self) -> Stylewhere
Self: Sized,
fn bold(self) -> Stylewhere
Self: Sized,
Return a Style with bold formatting enabled Read more
Auto Trait Implementations§
impl Freeze for StyledString
impl RefUnwindSafe for StyledString
impl Send for StyledString
impl Sync for StyledString
impl Unpin for StyledString
impl UnwindSafe for StyledString
Blanket Implementations§
Source§impl<T> AnsiStyleExt for Twhere
T: Display,
impl<T> AnsiStyleExt for Twhere
T: Display,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more