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§
sourcefn poll_read(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &mut [u8]
) -> Poll<Result<usize, Self::Error>>
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.