[][src]Trait vujio_server::_

pub trait _ {
    pub fn poll_read(
        self: Pin<&mut Self>,
        cx: &mut Context<'_>,
        buf: &mut [u8]
    ) -> Poll<Result<usize, Error>>; pub fn poll_read_vectored(
        self: Pin<&mut Self>,
        cx: &mut Context<'_>,
        bufs: &mut [IoSliceMut<'_>]
    ) -> Poll<Result<usize, Error>> { ... } }

Read bytes asynchronously.

This trait is analogous to the std::io::Read trait, but integrates with the asynchronous task system. In particular, the poll_read method, unlike Read::read, will automatically queue the current task for wakeup and return if data is not yet available, rather than blocking the calling thread.

Required methods

pub fn poll_read(
    self: Pin<&mut Self>,
    cx: &mut Context<'_>,
    buf: &mut [u8]
) -> Poll<Result<usize, Error>>
[src]

Attempt to read from the AsyncRead into buf.

On success, returns Poll::Ready(Ok(num_bytes_read)).

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

Implementation

This function may not return errors of kind WouldBlock or Interrupted. Implementations must convert WouldBlock into Poll::Pending and either internally retry or convert Interrupted into another error kind.

Loading content...

Provided methods

pub fn poll_read_vectored(
    self: Pin<&mut Self>,
    cx: &mut Context<'_>,
    bufs: &mut [IoSliceMut<'_>]
) -> Poll<Result<usize, Error>>
[src]

Attempt to read from the AsyncRead into bufs using vectored IO operations.

This method is similar to poll_read, but allows data to be read into multiple buffers using a single operation.

On success, returns Poll::Ready(Ok(num_bytes_read)).

If no data is available for reading, the method returns Poll::Pending and arranges for the current task (via cx.waker().wake_by_ref()) to receive a notification when the object becomes readable or is closed. By default, this method delegates to using poll_read on the first nonempty buffer in bufs, or an empty one if none exists. Objects which support vectored IO should override this method.

Implementation

This function may not return errors of kind WouldBlock or Interrupted. Implementations must convert WouldBlock into Poll::Pending and either internally retry or convert Interrupted into another error kind.

Loading content...

Implementations on Foreign Types

impl AsyncRead for TcpStream[src]

impl AsyncRead for Empty[src]

impl AsyncRead for Repeat[src]

impl<R> AsyncRead for BufReader<R> where
    R: AsyncRead
[src]

impl<'_> AsyncRead for &'_ File[src]

impl AsyncRead for UnixStream[src]

impl<T> AsyncRead for Take<T> where
    T: AsyncRead
[src]

pub fn poll_read(
    self: Pin<&mut Take<T>>,
    cx: &mut Context<'_>,
    buf: &mut [u8]
) -> Poll<Result<usize, Error>>
[src]

Attempt to read from the AsyncRead into buf.

impl<'_> AsyncRead for &'_ TcpStream[src]

impl AsyncRead for File[src]

impl<T, U> AsyncRead for Chain<T, U> where
    T: AsyncRead,
    U: AsyncRead
[src]

impl<T> AsyncRead for Cursor<T> where
    T: AsRef<[u8]> + Unpin
[src]

impl<'_> AsyncRead for &'_ UnixStream[src]

impl AsyncRead for Stdin[src]

impl<'_> AsyncRead for &'_ [u8][src]

impl<'_, T> AsyncRead for &'_ mut T where
    T: AsyncRead + Unpin + ?Sized
[src]

impl<P> AsyncRead for Pin<P> where
    P: DerefMut + Unpin,
    <P as Deref>::Target: AsyncRead
[src]

impl<T> AsyncRead for Box<T, Global> where
    T: AsyncRead + Unpin + ?Sized
[src]

impl AsyncRead for ChildStdout

impl AsyncRead for ChildStderr

impl<T> AsyncRead for Async<T> where
    T: Read

impl<'_, T> AsyncRead for &'_ Async<T> where
    &'a T: for<'a> Read

impl<T> AsyncRead for ReadHalf<T> where
    T: Unpin + AsyncRead

impl AsyncRead for Empty

impl AsyncRead for Repeat

impl<R> AsyncRead for BufReader<R> where
    R: AsyncRead

impl<R> AsyncRead for Take<R> where
    R: AsyncRead

impl<R1, R2> AsyncRead for Chain<R1, R2> where
    R1: AsyncRead,
    R2: AsyncRead

impl<T> AsyncRead for AssertAsync<T> where
    T: Read

impl<T> AsyncRead for Cursor<T> where
    T: AsRef<[u8]> + Unpin

impl<R> AsyncRead for Bytes<R> where
    R: AsyncRead

impl<T> AsyncRead for Unblock<T> where
    T: 'static + Read + Send

impl AsyncRead for Connection[src]

impl AsyncRead for Response[src]

impl AsyncRead for Request[src]

impl AsyncRead for Body[src]

impl AsyncRead for Encoder

impl<'_, T> AsyncRead for &'_ Mutex<T> where
    T: Unpin + AsyncRead

impl<T> AsyncRead for Arc<T> where
    &'a T: for<'a> AsyncRead

impl<T> AsyncRead for Mutex<T> where
    T: Unpin + AsyncRead

impl AsyncRead for Encoder

Loading content...

Implementors

impl<State> AsyncRead for vujio_server::Request<State>[src]

Loading content...