Read

Trait Read 

Source
pub trait Read: Read {
    // Provided methods
    fn read_buf(&mut self, buf: ReadBufRef<'_, impl Bytes>) -> Result<()> { ... }
    fn read_buf_exact(&mut self, buf: ReadBufRef<'_, impl Bytes>) -> Result<()> { ... }
}
Expand description

A wrapper over io::Read to provide the custom read_buf* methods on stable

Provided Methods§

Source

fn read_buf(&mut self, buf: ReadBufRef<'_, impl Bytes>) -> Result<()>

Pull some bytes from this source into the specified buffer.

This is equivalent to the read method, except that it is passed a ReadBufRef rather than [u8] to allow use with uninitialized buffers. The new data will be appended to any existing contents of buf.

The default implementation delegates to read.

Source

fn read_buf_exact(&mut self, buf: ReadBufRef<'_, impl Bytes>) -> Result<()>

Read the exact number of bytes required to fill buf.

This is equivalent to the read_exact method, except that it is passed a ReadBufRef rather than [u8] to allow use with uninitialized buffers.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<R: Read> Read for R