Struct StandardStream

pub struct StandardStream { /* private fields */ }

Satisfies io::Write and WriteColor, and supports optional coloring to either of the standard output streams, stdout and stderr.

Implementations

impl StandardStream

fn stdout(choice: ColorChoice) -> StandardStream

Create a new StandardStream with the given color preferences that writes to standard output.

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 via the WriteColor trait.

fn stderr(choice: ColorChoice) -> StandardStream

Create a new StandardStream with the given color preferences that writes to standard error.

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 via the WriteColor trait.

fn lock(&self) -> StandardStreamLock<'_>

Lock the underlying writer.

The lock guard returned also satisfies io::Write and WriteColor.

This method is not reentrant. It may panic if lock is called while a StandardStreamLock is still alive.

Trait Implementations

impl Debug for StandardStream

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

impl Write for StandardStream

fn write(&mut self, b: &[u8]) -> Result<usize>
fn flush(&mut self) -> Result<()>

impl WriteColor for StandardStream

fn supports_color(&self) -> bool
fn set_color(&mut self, spec: &ColorSpec) -> Result<()>
fn reset(&mut self) -> Result<()>
fn is_synchronous(&self) -> bool

Auto Trait Implementations

impl Freeze for StandardStream

impl RefUnwindSafe for StandardStream

impl Send for StandardStream

impl Sync for StandardStream

impl Unpin for StandardStream

impl UnsafeUnpin for StandardStream

impl UnwindSafe for StandardStream

Blanket Implementations

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

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for StandardStream where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for StandardStream where T: ?Sized,

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

impl<T> From<T> for StandardStream

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into<U> for StandardStream where U: From<T>,

fn into(self) -> U

Calls U::from(self).

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

impl<T, U> TryFrom<U> for StandardStream where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for StandardStream where U: TryFrom<T>,

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