pub struct Stdout { /* private fields */ }Expand description
Handle to the inherited standard output stream.
Stdout is Copy; copying it creates another view of the same
process-wide stream and lock. Dropping it does not close file descriptor 1
or the Windows standard output handle.
Use lock to hold the stdout lock across multiple writes,
or write directly to the handle for per-call locking. See the
module-level documentation for buffering and Windows console behavior.
Implementations§
Source§impl Stdout
impl Stdout
Sourcepub fn lock(&self) -> StdoutLock<'static> ⓘ
pub fn lock(&self) -> StdoutLock<'static> ⓘ
Acquire stdout’s shared write lock.
While the returned guard is held, no other Stdout handle can write
through this module. The lock is not reentrant; attempting to write to
stdout through this module again on the same thread while holding the
guard will deadlock.
§Returns
A StdoutLock that implements Write.
§Errors and panics
This method does not return errors. If another thread panicked while holding the mutex, the poisoned lock is recovered and the guard is still returned.
Trait Implementations§
Source§impl AsFd for Stdout
impl AsFd for Stdout
Source§fn as_fd(&self) -> BorrowedFd<'_>
fn as_fd(&self) -> BorrowedFd<'_>
Source§impl Write for &Stdout
impl Write for &Stdout
Source§fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
can_vector)1.0.0 · Source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
write_all_vectored)Source§impl Write for Stdout
impl Write for Stdout
Source§fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
can_vector)1.0.0 · Source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
write_all_vectored)