pub trait IoExt {
Show 13 methods fn read(&self, buf: &mut [u8]) -> Result<usize>;
fn read_exact(&self, buf: &mut [u8]) -> Result<()>;
fn read_vectored(&self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>;
fn read_to_end(&self, buf: &mut Vec<u8>) -> Result<usize>;
fn read_to_string(&self, buf: &mut String) -> Result<usize>;
fn peek(&self, buf: &mut [u8]) -> Result<usize>;
fn write(&self, buf: &[u8]) -> Result<usize>;
fn write_all(&self, buf: &[u8]) -> Result<()>;
fn write_vectored(&self, bufs: &[IoSlice<'_>]) -> Result<usize>;
fn write_fmt(&self, fmt: Arguments<'_>) -> Result<()>;
fn flush(&self) -> Result<()>; fn read_exact_vectored(&self, bufs: &mut [IoSliceMut<'_>]) -> Result<()> { ... }
fn write_all_vectored(&self, bufs: &mut [IoSlice<'_>]) -> Result<()> { ... }
}
Expand description

Extension trait for I/O handles that are exterior-mutable readable and writeable.

Required methods

Pull some bytes from this source into the specified buffer, returning how many bytes were read.

This is similar to std::io::Read::read, except it takes self by immutable reference since the entire side effect is I/O.

Read the exact number of bytes required to fill buf.

This is similar to std::io::Read::read_exact, except it takes self by immutable reference since the entire side effect is I/O.

Like read, except that it reads into a slice of buffers.

This is similar to std::io::Read::read_vectored, except it takes self by immutable reference since the entire side effect is I/O.

Read all bytes until EOF in this source, placing them into buf.

This is similar to std::io::Read::read_to_end, except it takes self by immutable reference since the entire side effect is I/O.

Read all bytes until EOF in this source, appending them to buf.

This is similar to std::io::Read::read_to_string, except it takes self by immutable reference since the entire side effect is I/O.

Read bytes from the current position without advancing the current position.

This is similar to crate::io::Peek::peek, except it takes self by immutable reference since the entire side effect is I/O.

Write a buffer into this writer, returning how many bytes were written.

This is similar to std::io::Write::write, except it takes self by immutable reference since the entire side effect is I/O.

Attempts to write an entire buffer into this writer.

This is similar to std::io::Write::write_all, except it takes self by immutable reference since the entire side effect is I/O.

Like write, except that it writes from a slice of buffers.

This is similar to std::io::Write::write_vectored, except it takes self by immutable reference since the entire side effect is I/O.

Writes a formatted string into this writer, returning any error encountered.

This is similar to std::io::Write::write_fmt, except it takes self by immutable reference since the entire side effect is I/O.

Flush this output stream, ensuring that all intermediately buffered contents reach their destination.

This is similar to std::io::Write::flush, except it takes self by immutable reference since the entire side effect is I/O.

Provided methods

Is to read_vectored what read_exact is to read.

Is to write_vectored what write_all is to write.

Implementors

Implement IoExt for any type which implements AsRawFd.