Trait hyper::rt::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§