hyper::rt

Trait Read

Source
pub trait Read {
    // Required method
    fn poll_read(
        self: Pin<&mut Self>,
        cx: &mut Context<'_>,
        buf: ReadBufCursor<'_>,
    ) -> Poll<Result<(), Error>>;
}
Expand description

Reads bytes from a source.

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

Required Methods§

Source

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.

Implementations on Foreign Types§

Source§

impl<P> Read for Pin<P>
where P: DerefMut, P::Target: Read,

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Implementors§