[][src]Struct render_tree::stylesheet::ColorAccumulator

pub struct ColorAccumulator { /* fields omitted */ }

A facility for creating visually inspectable representations of colored output so they can be easily tested.

A new color is represented as {style} and a reset is represented by {/}.

Attributes are printed in this order:

  • Foreground color as fg:Color
  • Background color as bg:Color
  • Bold as bold
  • Underline as underline
  • Intense as bright

For example, the style "intense, bold red foreground" would be printed as:

{fg:Red bold intense}

Since this implementation attempts to make it possible to faithfully understand what real WriteColor implementations would do, it tries to approximate the contract in the WriteColor trait: "Subsequent writes to this write will use these settings until either reset is called or new color settings are set.")

  • If set_color is called with a style, {...} is emitted containing the color attributes.
  • If set_color is called with no style, {/} is emitted
  • If reset is called, {/} is emitted

Methods

impl ColorAccumulator
[src]

Important traits for ColorAccumulator
pub fn new() -> ColorAccumulator
[src]

pub fn to_string(self) -> String
[src]

Trait Implementations

impl Write for ColorAccumulator
[src]

fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
1.0.0
[src]

Attempts to write an entire buffer into this writer. Read more

fn write_fmt(&mut self, fmt: Arguments) -> Result<(), Error>
1.0.0
[src]

Writes a formatted string into this writer, returning any error encountered. Read more

fn by_ref(&mut self) -> &mut Self
1.0.0
[src]

Creates a "by reference" adaptor for this instance of Write. Read more

impl WriteColor for ColorAccumulator
[src]

fn is_synchronous(&self) -> bool
[src]

Returns true if and only if the underlying writer must synchronously interact with an end user's device in order to control colors. By default, this always returns false. Read more

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> BorrowMut for T where
    T: ?Sized
[src]