pub struct StyledTerminalText { /* private fields */ }
Expand description
Holds and displays text that will print with the specified color in a terminal.
§Examples
use terminal_text_styler::{StyledTerminalText, TerminalStyle};
let greeting = StyledTerminalText::new("Hello, World!", TerminalStyle::bright_yellow());
assert_eq!(greeting.output(), "\u{001B}[1;93mHello, World!\u{001B}[0m");
Implementations§
Source§impl StyledTerminalText
impl StyledTerminalText
Sourcepub fn style(&self) -> &TerminalStyle
pub fn style(&self) -> &TerminalStyle
Gets the TerminalStyle
instance
Sourcepub fn change_text_to(&mut self, new_text: &str) -> String
pub fn change_text_to(&mut self, new_text: &str) -> String
Changes text and returns the existing text.
Sourcepub fn change_style_to(&mut self, new_style: TerminalStyle) -> TerminalStyle
pub fn change_style_to(&mut self, new_style: TerminalStyle) -> TerminalStyle
Changes style and returns the existing style.
Sourcepub fn new(text: &str, style: TerminalStyle) -> Self
pub fn new(text: &str, style: TerminalStyle) -> Self
Creates from a string and terminal color
Trait Implementations§
Source§impl Debug for StyledTerminalText
impl Debug for StyledTerminalText
Source§impl Display for StyledTerminalText
impl Display for StyledTerminalText
Source§impl PartialEq for StyledTerminalText
impl PartialEq for StyledTerminalText
impl Eq for StyledTerminalText
Auto Trait Implementations§
impl Freeze for StyledTerminalText
impl RefUnwindSafe for StyledTerminalText
impl Send for StyledTerminalText
impl Sync for StyledTerminalText
impl Unpin for StyledTerminalText
impl UnwindSafe for StyledTerminalText
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