Struct BufferWriter
struct BufferWriter { ... }
Writes colored buffers to stdout or stderr.
Writable buffers can be obtained by calling buffer on a BufferWriter.
This writer works with terminals that support ANSI escape sequences or with a Windows console.
It is intended for a BufferWriter to be put in an Arc and written to
from multiple threads simultaneously.
Implementations
impl BufferWriter
fn stdout(choice: ColorChoice) -> BufferWriterCreate a new
BufferWriterthat writes to stdout with the given color preferences.On Windows, if coloring is desired and a Windows console could not be found, then ANSI escape sequences are used instead.
The specific color/style settings can be configured when writing to the buffers themselves.
fn stderr(choice: ColorChoice) -> BufferWriterCreate a new
BufferWriterthat writes to stderr with the given color preferences.On Windows, if coloring is desired and a Windows console could not be found, then ANSI escape sequences are used instead.
The specific color/style settings can be configured when writing to the buffers themselves.
fn separator(self: &mut Self, sep: Option<Vec<u8>>)If set, the separator given is printed between buffers. By default, no separator is printed.
The default value is
None.fn buffer(self: &Self) -> BufferCreates a new
Bufferwith the current color preferences.A
Buffersatisfies bothio::WriteandWriteColor. ABuffercan be printed using theprintmethod.fn print(self: &Self, buf: &Buffer) -> io::Result<()>Prints the contents of the given buffer.
It is safe to call this from multiple threads simultaneously. In particular, all buffers are written atomically. No interleaving will occur.
impl Debug for BufferWriter
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<'_>) -> $crate::fmt::Result
impl Freeze for BufferWriter
impl RefUnwindSafe for BufferWriter
impl Send for BufferWriter
impl Sync for BufferWriter
impl Unpin for BufferWriter
impl UnwindSafe for BufferWriter
impl<T> Any for BufferWriter
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for BufferWriter
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for BufferWriter
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> From for BufferWriter
fn from(t: T) -> TReturns the argument unchanged.
impl<T, U> Into for BufferWriter
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for BufferWriter
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for BufferWriter
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>