pub struct Stderr(/* private fields */);Available on crate features
std and default only.Expand description
A handle to the standard error of the current process.
This writer is created by the stderr function. See its documentation for
more.
§Note: Windows Portability Consideration
When operating in a console, the Windows implementation of this stream does not support non-UTF-8 byte sequences. Attempting to write bytes that are not valid UTF-8 will return an error.
Implementations§
Source§impl Stderr
impl Stderr
Sourcepub async fn lock(&self) -> StderrLock<'static>
Available on unstable only.
pub async fn lock(&self) -> StderrLock<'static>
unstable only.Locks this handle to the standard error stream, returning a writable guard.
The lock is released when the returned lock goes out of scope. The returned guard also implements the Write trait for writing data.
§Examples
use async_std::io;
use async_std::prelude::*;
let stderr = io::stderr();
let mut handle = stderr.lock().await;
handle.write_all(b"hello world").await?;Trait Implementations§
Source§impl AsRawHandle for Stderr
Available on Windows only.
impl AsRawHandle for Stderr
Available on Windows only.
Source§fn as_raw_handle(&self) -> RawHandle
fn as_raw_handle(&self) -> RawHandle
Available on crate features
std and docs only.Extracts the raw handle, without taking any ownership.
Source§impl Write for Stderr
impl Write for Stderr
Source§fn poll_write(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &[u8],
) -> Poll<Result<usize>>
fn poll_write( self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8], ) -> Poll<Result<usize>>
Available on crate feature
docs only.Attempt to write bytes from
buf into the object.Source§fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
Available on crate feature
docs only.Attempt to flush the object, ensuring that any buffered data reach
their destination.
Source§fn poll_close(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_close(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
Available on crate feature
docs only.Attempt to close the object.
Source§fn poll_write_vectored(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
bufs: &[IoSlice<'_>],
) -> Poll<Result<usize>>
fn poll_write_vectored( self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &[IoSlice<'_>], ) -> Poll<Result<usize>>
Available on crate feature
docs only.Attempt to write bytes from
bufs into the object using vectored IO operations.Source§fn write<'a>(&'a mut self, buf: &'a [u8]) -> ImplFuture<Result<usize>>where
Self: Unpin,
fn write<'a>(&'a mut self, buf: &'a [u8]) -> ImplFuture<Result<usize>>where
Self: Unpin,
Available on crate feature
docs only.Writes some bytes into the byte stream. Read more
Source§fn flush(&mut self) -> ImplFuture<Result<()>>where
Self: Unpin,
fn flush(&mut self) -> ImplFuture<Result<()>>where
Self: Unpin,
Available on crate feature
docs only.Flushes the stream to ensure that all buffered contents reach their destination. Read more
Source§fn write_vectored<'a>(
&'a mut self,
bufs: &'a [IoSlice<'a>],
) -> ImplFuture<Result<usize>>where
Self: Unpin,
fn write_vectored<'a>(
&'a mut self,
bufs: &'a [IoSlice<'a>],
) -> ImplFuture<Result<usize>>where
Self: Unpin,
Available on crate feature
docs only.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§
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
Source§impl<T> WriteExt for T
impl<T> WriteExt for T
Source§fn write<'a>(&'a mut self, buf: &'a [u8]) -> WriteFuture<'a, Self>where
Self: Unpin,
fn write<'a>(&'a mut self, buf: &'a [u8]) -> WriteFuture<'a, Self>where
Self: Unpin,
Available on crate feature
std only.Writes some bytes into the byte stream. Read more
Source§fn flush(&mut self) -> FlushFuture<'_, Self>where
Self: Unpin,
fn flush(&mut self) -> FlushFuture<'_, Self>where
Self: Unpin,
Available on crate feature
std only.Flushes the stream to ensure that all buffered contents reach their destination. Read more
Source§fn write_vectored<'a>(
&'a mut self,
bufs: &'a [IoSlice<'a>],
) -> WriteVectoredFuture<'a, Self>where
Self: Unpin,
fn write_vectored<'a>(
&'a mut self,
bufs: &'a [IoSlice<'a>],
) -> WriteVectoredFuture<'a, Self>where
Self: Unpin,
Available on crate feature
std only.