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
Write a buffer into this writer, returning how many bytes were written. Read more
Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
Attempts to write an entire buffer into this writer. Read more
Writes a formatted string into this writer, returning any error encountered. Read more
Creates a "by reference" adaptor for this instance of Write
. Read more
Returns true if and only if the underlying writer supports colors.
Set the color settings of the writer. Read more
Reset the current color settings to their original settings. Read more
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
type Error = !
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
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.
🔬 This is a nightly-only experimental API. (try_from
)
Mutably borrows from an owned value. Read more