pub struct Formatter<'a> { /* private fields */ }
Expand description
Heavier formatter that allows the possibility of
custom styles in strings. That is the only reason
this struct exists, if you don’t need custom things
just use the colorize_string()
function provided
in the module.
Implementations§
source§impl<'a> Formatter<'a>
impl<'a> Formatter<'a>
sourcepub fn new_style(&mut self, key: &str, colors: Vec<&'a str>) -> &mut Self
pub fn new_style(&mut self, key: &str, colors: Vec<&'a str>) -> &mut Self
Tell the formatter that you want a new style and what colors that style equates to so it knows what to replace it with when formatting
§Example
use paris::formatter::Formatter;
let mut fmt = Formatter::new();
fmt.new_style("lol", vec!["green", "bold", "on_blue"]);
// '<lol>' is now a key that can be used in strings
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Formatter<'a>
impl<'a> RefUnwindSafe for Formatter<'a>
impl<'a> Send for Formatter<'a>
impl<'a> Sync for Formatter<'a>
impl<'a> Unpin for Formatter<'a>
impl<'a> UnwindSafe for Formatter<'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