Trait Read

trait Read

Reads bytes from a source.

This trait is similar to std::io::Read, but supports asynchronous reads.

Required Methods

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

Attempts to read bytes into the buf.

On success, returns Poll::Ready(Ok(())) and places data in the unfilled portion of buf. If no data was read (buf.remaining() is unchanged), it implies that EOF has been reached.

If no data is available for reading, the method returns Poll::Pending and arranges for the current task (via cx.waker()) to receive a notification when the object becomes readable or is closed.

Implementors