Trait async_hal::io::AsyncRead

source ·
pub trait AsyncRead {
    type Error;

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

Read bytes asynchronously.

Required Associated Types§

Required Methods§

source

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

Attempt to read from the AsyncRead into buf. On success, returns Poll::Ready(Ok(num_bytes_read)). If no data is available for reading, this method returns Poll::Pending and arranges for the current task to be woken.

Implementors§

source§

impl<T, E> AsyncRead for Reader<T>where T: Stream<Item = Result<u8, E>> + Unpin,

§

type Error = E