Skip to main content

AsyncReadManaged

Trait AsyncReadManaged 

Source
pub trait AsyncReadManaged {
    type Buffer: IoBuf;

    // Required method
    async fn read_managed(
        &mut self,
        len: usize,
    ) -> Result<Option<Self::Buffer>, Error>;
}
Available on crate feature io only.
Expand description

§AsyncReadManaged

Async read with buffer pool

Required Associated Types§

Source

type Buffer: IoBuf

Filled buffer type

Required Methods§

Source

async fn read_managed( &mut self, len: usize, ) -> Result<Option<Self::Buffer>, Error>

Read some bytes from this source and return a Self::Buffer.

Returning Ok(None) is similar to Ok(0) for normal AsyncRead.

§Implementation Note
  • If len == 0, implementation should use buffer’s size as len
  • if len > 0, min(len, buffer_size) will be the max number of bytes to be read.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§