Trait AsyncRead

Source
pub trait AsyncRead {
    type Error: ReadError;

    // Required method
    fn poll_read_slice(
        self: Pin<&mut Self>,
        cx: &mut Context<'_>,
        buf: &mut [u8],
    ) -> Poll<Result<usize, Self::Error>>;
}
Expand description

This trait is the asynchronous version of Read.

Required Associated Types§

Source

type Error: ReadError

Error type for IO operations involving the reader.

Required Methods§

Source

fn poll_read_slice( self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut [u8], ) -> Poll<Result<usize, Self::Error>>

Poll the reader once and read some bytes into the slice buf.

This method reads bytes directly into buf and reports how many bytes it read.

Implementations on Foreign Types§

Source§

impl<T: AsyncRead + Unpin + ?Sized> AsyncRead for &mut T

Source§

type Error = <T as AsyncRead>::Error

Source§

fn poll_read_slice( self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut [u8], ) -> Poll<Result<usize, Self::Error>>

Source§

impl<T: AsyncRead + Unpin + ?Sized> AsyncRead for Box<T>

Available on crate feature alloc only.
Source§

type Error = <T as AsyncRead>::Error

Source§

fn poll_read_slice( self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut [u8], ) -> Poll<Result<usize, Self::Error>>

Implementors§

Source§

impl<B: Buf + Unpin> AsyncRead for Reader<B>

Source§

impl<T> AsyncRead for Futures<T>
where T: AsyncRead,

Available on crate feature futures only.
Source§

impl<T> AsyncRead for NativeAsync<T>
where T: AsyncRead,

Source§

impl<T> AsyncRead for Smol<T>
where T: AsyncRead,

Available on crate feature smol only.
Source§

impl<T> AsyncRead for Tokio<T>
where T: AsyncRead,

Available on crate feature tokio only.