pub struct ANSIStringBuilder { /* private fields */ }
Expand description

A helper factory struct for an easy way to produce many ANSIString with same styles and colors

Implementations§

source§

impl ANSIStringBuilder

source

pub fn new() -> Self

Returns new instance of ANSIStringBuilder

source

pub fn clear(&mut self)

Clear all styles and colors from the builder

source

pub fn build<T: AsRef<str>>(&self, s: T) -> ANSIString<T>

Builds a new ANSIString instance without consuming builder

Trait Implementations§

source§

impl Clone for ANSIStringBuilder

source§

fn clone(&self) -> ANSIStringBuilder

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Colored for ANSIStringBuilder

§

type Output = ANSIStringBuilder

This is returned by all methods
source§

fn blue(self) -> Self::Output

Colors foreground of a string in blue Read more
source§

fn on_blue(self) -> Self::Output

Colors background of a string in blue Read more
source§

fn cyan(self) -> Self::Output

Colors foreground of a string in cyan Read more
source§

fn on_cyan(self) -> Self::Output

Colors background of a string in cyan Read more
source§

fn green(self) -> Self::Output

Colors foreground of a string in green Read more
source§

fn on_green(self) -> Self::Output

Colors background of a string in green Read more
source§

fn magenta(self) -> Self::Output

Colors foreground of a string in magenta Read more
source§

fn on_magenta(self) -> Self::Output

Colors background of a string in magenta Read more
source§

fn orange(self) -> Self::Output

Colors foreground of a string in orange Read more
source§

fn on_orange(self) -> Self::Output

Colors background of a string in orange Read more
source§

fn red(self) -> Self::Output

Colors foreground of a string in red Read more
source§

fn on_red(self) -> Self::Output

Colors background of a string in red Read more
source§

fn yellow(self) -> Self::Output

Colors foreground of a string in yellow Read more
source§

fn on_yellow(self) -> Self::Output

Colors background of a string in yellow Read more
source§

fn rgb(self, rgb: (u8, u8, u8)) -> Self::Output

Colors foreground of a string in rgb Read more
source§

fn on_rgb(self, rgb: (u8, u8, u8)) -> Self::Output

Colors background of a string in rgb Read more
source§

impl Debug for ANSIStringBuilder

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for ANSIStringBuilder

source§

fn default() -> ANSIStringBuilder

Returns the “default value” for a type. Read more
source§

impl Styled for ANSIStringBuilder

§

type Output = ANSIStringBuilder

This is returned by all methods
source§

fn bold(self) -> Self::Output

Causes a string to be displayed as bold Read more
source§

fn dim(self) -> Self::Output

Causes a string to appear darker (not widely supported) Read more
source§

fn italic(self) -> Self::Output

Causes a string to be displayed as italic Read more
source§

fn underline(self) -> Self::Output

Causes a string to be displayed as underlined Read more
Causes a string to blink (not widely supported) Read more
source§

fn invert(self) -> Self::Output

Inverts colors of a string (not widely supported) Read more
source§

fn hide(self) -> Self::Output

Hides a string (not widely supported) Read more
source§

fn strikethrough(self) -> Self::Output

Causes a string to be displayed as striked out Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.