Trait salvo_core::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 as Deref>::Target: Read,

source§

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

source§

impl<T> Read for MaybeHttpsStream<T>
where T: Read + Write + Unpin,

source§

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

source§

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

source§

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

source§

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

source§

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

Implementors§

source§

impl Read for Upgraded

source§

impl<T> Read for TokioIo<T>
where T: AsyncRead,