pub struct StdoutOverride { /* private fields */ }
Expand description
An overridden standard output.
Writing to this writes to the original standard output. When it is dropped the standard output will be reset.
Implementations§
Source§impl StdoutOverride
impl StdoutOverride
Sourcepub fn from_raw(raw: RawFd) -> Result<Self>
pub fn from_raw(raw: RawFd) -> Result<Self>
Redirect standard output to the raw file descriptor or handle. It must be writable.
The stream is not owned, so it is your job to close it later. Closing it while this exists will not close the standard output.
Sourcepub fn from_raw_owned(raw: RawFd) -> Result<Self>
pub fn from_raw_owned(raw: RawFd) -> Result<Self>
Redirect standard output to the owned raw file descriptor or handle. It must be writable.
The stream is owned, and so you must not use it after passing it to this function.
Sourcepub fn from_io_ref<T: AsRaw>(io: &T) -> Result<Self>
pub fn from_io_ref<T: AsRaw>(io: &T) -> Result<Self>
Redirect standard output to the IO device. The device must be writable.
Dropping the IO device after calling this function will not close the standard output.
Sourcepub fn from_io<T: IntoRaw>(io: T) -> Result<Self>
pub fn from_io<T: IntoRaw>(io: T) -> Result<Self>
Redirect standard output to the IO device. The device must be writable.
Trait Implementations§
Source§impl AsRawFd for StdoutOverride
impl AsRawFd for StdoutOverride
Source§impl Debug for StdoutOverride
impl Debug for StdoutOverride
Source§impl Drop for StdoutOverride
impl Drop for StdoutOverride
Source§impl Write for &StdoutOverride
impl Write for &StdoutOverride
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
Source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
🔬This is a nightly-only experimental API. (
write_all_vectored
)Attempts to write multiple buffers into this writer. Read more
Source§impl Write for StdoutOverride
impl Write for StdoutOverride
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
Source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
🔬This is a nightly-only experimental API. (
write_all_vectored
)Attempts to write multiple buffers into this writer. Read more
Auto Trait Implementations§
impl Freeze for StdoutOverride
impl RefUnwindSafe for StdoutOverride
impl Send for StdoutOverride
impl Sync for StdoutOverride
impl Unpin for StdoutOverride
impl UnwindSafe for StdoutOverride
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