AsyncRead

Trait AsyncRead 

Source
pub trait AsyncRead {
    // Required method
    async fn read(&mut self, buf: &mut [u8]) -> Result<usize>;

    // Provided methods
    async fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> { ... }
    fn as_async_input_stream(&self) -> Option<&AsyncInputStream> { ... }
}
Expand description

Read bytes from a source.

Required Methods§

Source

async fn read(&mut self, buf: &mut [u8]) -> Result<usize>

Provided Methods§

Source

async fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>

Source

fn as_async_input_stream(&self) -> Option<&AsyncInputStream>

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.

Implementations on Foreign Types§

Source§

impl<R: AsyncRead + ?Sized> AsyncRead for &mut R

Source§

async fn read(&mut self, buf: &mut [u8]) -> Result<usize>

Source§

async fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>

Source§

fn as_async_input_stream(&self) -> Option<&AsyncInputStream>

Implementors§