[−][src]Trait tokio_io::AsyncReadExt
An extension trait which adds utility methods to AsyncRead
types.
Provided methods
fn chain<R>(self, next: R) -> Chain<Self, R> where
Self: Sized,
R: AsyncRead,
Self: Sized,
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<'a, W: ?Sized>(&'a mut self, dst: &'a mut W) -> Copy<'a, Self, W> where
Self: Unpin,
W: AsyncWrite + Unpin,
Self: Unpin,
W: AsyncWrite + Unpin,
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>(&'a mut self, dst: &'a mut [u8]) -> Read<'a, Self> where
Self: Unpin,
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>(&'a mut self, dst: &'a mut [u8]) -> ReadExact<'a, Self> where
Self: Unpin,
Self: Unpin,
Read exactly the amount of data needed to fill the provided buffer.
fn read_to_end<'a>(&'a mut self, dst: &'a mut Vec<u8>) -> ReadToEnd<'a, Self> where
Self: Unpin,
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>(
&'a mut self,
dst: &'a mut String
) -> ReadToString<'a, Self> where
Self: Unpin,
&'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> where
Self: Sized,
Self: Sized,
Creates an AsyncRead adapter which will read at most limit
bytes
from the underlying reader.