pub struct Text<'a> {
pub text: &'a str,
pub color: ColorType,
pub bg_color: ColorType,
pub bold: bool,
pub endl: bool,
}Expand description
Configurable text display with color, background and style options.
Used for building formatted console output with various display attributes.
Fields§
§text: &'a strThe actual text content.
color: ColorTypeThe color of the text.
bg_color: ColorTypeThe background color of the text.
bold: boolWhether the text should be bold.
endl: boolWhether to add newline after the text
Implementations§
Source§impl<'a> Text<'a>
impl<'a> Text<'a>
Sourcepub fn get_display_str_cow(&self) -> Cow<'a, str>
pub fn get_display_str_cow(&self) -> Cow<'a, str>
Gets the display string as a Cow (clone on write).
This method generates a formatted string that represents the text with the appropriate color and background color. If the text is bold, it applies bold formatting to the text color.
§Returns
Cow<'a, str>: An owned copy of the formatted string.
Trait Implementations§
Source§impl<'a> Default for Text<'a>
Default implementation for Text with empty content and default styling.
impl<'a> Default for Text<'a>
Default implementation for Text with empty content and default styling.
Source§impl<'a> Ord for Text<'a>
impl<'a> Ord for Text<'a>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<'a> PartialOrd for Text<'a>
impl<'a> PartialOrd for Text<'a>
impl<'a> Copy for Text<'a>
impl<'a> Eq for Text<'a>
impl<'a> StructuralPartialEq for Text<'a>
Auto Trait Implementations§
impl<'a> Freeze for Text<'a>
impl<'a> RefUnwindSafe for Text<'a>
impl<'a> Send for Text<'a>
impl<'a> Sync for Text<'a>
impl<'a> Unpin for Text<'a>
impl<'a> UnsafeUnpin for Text<'a>
impl<'a> UnwindSafe for Text<'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