Struct Stderr

pub struct Stderr { /* private fields */ }

A handle to the standard error stream of a process.

Concurrent writes to stderr must be executed with care: Only individual writes to this AsyncWrite are guaranteed to be intact. In particular you should be aware that writes using write_all are not guaranteed to occur as a single write, so multiple threads writing data with write_all may result in interleaved output.

Created by the stderr function.

Examples

use tokio::io::{self, AsyncWriteExt};

#[tokio::main]
async fn main() -> io::Result<()> {
    let mut stderr = io::stderr();
    stderr.write_all(b"Print some error here.").await?;
    Ok(())
}

Trait Implementations

impl AsFd for Stderr

fn as_fd(&self) -> BorrowedFd<'_>

impl AsRawFd for Stderr

fn as_raw_fd(&self) -> RawFd

impl AsyncWrite for Stderr

fn poll_write(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8]) -> Poll<Result<usize>>
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Error>>
fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Error>>

impl Debug for Stderr

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

Auto Trait Implementations

impl Freeze for Stderr

impl RefUnwindSafe for Stderr

impl Send for Stderr

impl Sync for Stderr

impl Unpin for Stderr

impl UnsafeUnpin for Stderr

impl UnwindSafe for Stderr

Blanket Implementations

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

impl<T> From<T> for Stderr

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into<U> for Stderr 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 Stderr where U: Into<T>,

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

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

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

impl<W> AsyncWriteExt for Stderr where W: AsyncWrite + ?Sized,