pub struct AnsiWriter<W: Write + AnsiPreference> { /* private fields */ }Expand description
A Writer that writes styled output to an inner Write using
a configurable default Ansi instance.
Note: only calls to this Writer’s write_fmt() method
will have the default ANSI styling applied. Calls to any other Write
methods are unaffected.
Implementations§
Trait Implementations§
Source§impl<W: Write + AnsiPreference> AnsiPreference for AnsiWriter<W>
impl<W: Write + AnsiPreference> AnsiPreference for AnsiWriter<W>
Source§fn is_ansi_preferred(&self) -> bool
fn is_ansi_preferred(&self) -> bool
Determines if this
Writer prefers to enable ANSI styles in its output. Read moreSource§fn is_ansi_forced(&self) -> bool
fn is_ansi_forced(&self) -> bool
Determines if ANSI codes should be enabled because the
FORCE_COLOR
env variable has been set.Source§fn is_ansi_banned(&self) -> bool
fn is_ansi_banned(&self) -> bool
Determines if ANSI codes should be disabled because the
NO_COLOR
env variable has been set.Source§impl<W: Write + AnsiPreference> AnsiWrite for AnsiWriter<W>
impl<W: Write + AnsiPreference> AnsiWrite for AnsiWriter<W>
Source§fn is_no_ansi(&self) -> bool
fn is_no_ansi(&self) -> bool
Determines whether this
Writer’s default Ansi style prohibits
writing of all nested ANSI styles.Source§fn is_all_ansi(&self) -> bool
fn is_all_ansi(&self) -> bool
Determines whether this
Writer’s default Ansi style allows
writing of all nested ANSI styles.Source§fn auto_ansi(&mut self)
fn auto_ansi(&mut self)
Sets this
Writer’s default Ansi style to
its preferred_ansi(), such that
rendering of nested ANSI styles during subsequent writes is enabled/disabled.Source§impl<W: Write + AnsiPreference> Write for AnsiWriter<W>
impl<W: Write + AnsiPreference> Write for AnsiWriter<W>
Source§fn write_fmt(&mut self, fmt: Arguments<'_>) -> Result<()>
fn write_fmt(&mut self, fmt: Arguments<'_>) -> Result<()>
Writes a formatted string into this writer, returning any error
encountered. Read more
Source§fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Writes a buffer into this writer, returning how many bytes were written. Read more
Source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Flushes this output stream, ensuring that all intermediately buffered
contents reach their destination. Read more
Source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (
can_vector)1.0.0 · Source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Attempts to write an entire buffer into this writer. Read more
Auto Trait Implementations§
impl<W> Freeze for AnsiWriter<W>where
W: Freeze,
impl<W> RefUnwindSafe for AnsiWriter<W>where
W: RefUnwindSafe,
impl<W> Send for AnsiWriter<W>where
W: Send,
impl<W> Sync for AnsiWriter<W>where
W: Sync,
impl<W> Unpin for AnsiWriter<W>where
W: Unpin,
impl<W> UnwindSafe for AnsiWriter<W>where
W: UnwindSafe,
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