pub struct ColoredString { /* private fields */ }
Expand description
A string with an associated style
Implementations§
Source§impl ColoredString
impl ColoredString
Sourcepub fn with_style(self, additional: Style) -> Self
pub fn with_style(self, additional: Style) -> Self
Apply additional style to existing ColoredString
§Examples
use inksac::{Style, Color, Styleable};
let base_style = Style::builder()
.foreground(Color::Blue)
.build();
let highlight = Style::builder()
.bold()
.build();
let text = "Hello".style(base_style)
.with_style(highlight);
Sourcepub fn into_string(self) -> String
pub fn into_string(self) -> String
Convert to a plain string with all styling removed
Trait Implementations§
Source§impl Clone for ColoredString
impl Clone for ColoredString
Source§fn clone(&self) -> ColoredString
fn clone(&self) -> ColoredString
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ColoredString
impl Debug for ColoredString
Auto Trait Implementations§
impl Freeze for ColoredString
impl RefUnwindSafe for ColoredString
impl Send for ColoredString
impl Sync for ColoredString
impl Unpin for ColoredString
impl UnwindSafe for ColoredString
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