[][src]Trait tokio::io::AsyncReadExt

pub trait AsyncReadExt: AsyncRead {
    fn chain<R>(self, next: R) -> Chain<Self, R>
    where
        R: AsyncRead
, { ... }
fn copy<W>(&'a mut self, dst: &'a mut W) -> Copy<'a, Self, W>
    where
        Self: Unpin,
        W: AsyncWrite + Unpin + ?Sized
, { ... }
fn read(&'a mut self, dst: &'a mut [u8]) -> Read<'a, Self>
    where
        Self: Unpin
, { ... }
fn read_exact(&'a mut self, dst: &'a mut [u8]) -> ReadExact<'a, Self>
    where
        Self: Unpin
, { ... }
fn read_to_end(&'a mut self, dst: &'a mut Vec<u8>) -> ReadToEnd<'a, Self>
    where
        Self: Unpin
, { ... }
fn read_to_string(
        &'a mut self,
        dst: &'a mut String
    ) -> ReadToString<'a, Self>
    where
        Self: Unpin
, { ... }
fn take(self, limit: u64) -> Take<Self> { ... } }

An extension trait which adds utility methods to AsyncRead types.

Provided methods

fn chain<R>(self, next: R) -> Chain<Self, R> where
    R: AsyncRead

Creates an adaptor which will chain this stream with another.

The returned AsyncRead instance will first read all bytes from this object until EOF is encountered. Afterwards the output is equivalent to the output of next.

fn copy<W>(&'a mut self, dst: &'a mut W) -> Copy<'a, Self, W> where
    Self: Unpin,
    W: AsyncWrite + Unpin + ?Sized

Copy all data from self into the provided AsyncWrite.

The returned future will copy all the bytes read from reader into the writer specified. This future will only complete once the reader has hit EOF and all bytes have been written to and flushed from the writer provided.

On success the number of bytes is returned and the reader and writer are consumed. On error the error is returned and the I/O objects are consumed as well.

fn read(&'a mut self, dst: &'a mut [u8]) -> Read<'a, Self> where
    Self: Unpin

Read data into the provided buffer.

The returned future will resolve to the number of bytes read once the read operation is completed.

fn read_exact(&'a mut self, dst: &'a mut [u8]) -> ReadExact<'a, Self> where
    Self: Unpin

Read exactly the amount of data needed to fill the provided buffer.

fn read_to_end(&'a mut self, dst: &'a mut Vec<u8>) -> ReadToEnd<'a, Self> where
    Self: Unpin

Read all bytes until EOF in this source, placing them into dst.

On success the total number of bytes read is returned.

fn read_to_string(&'a mut self, dst: &'a mut String) -> ReadToString<'a, Self> where
    Self: Unpin

Read all bytes until EOF in this source, placing them into dst.

On success the total number of bytes read is returned.

fn take(self, limit: u64) -> Take<Self>

Creates an AsyncRead adapter which will read at most limit bytes from the underlying reader.

Loading content...

Implementors

impl<R> AsyncReadExt for R where
    R: AsyncRead + ?Sized
[src]

Loading content...