Expand description
Asynchronous I/O.
This module is the asynchronous version of std::io
. Primarily, it
defines two traits, AsyncRead
and AsyncWrite
, which extend the
Read
and Write
traits of the standard library.
AsyncRead and AsyncWrite
AsyncRead
and AsyncWrite
must only be implemented for
non-blocking I/O types that integrate with the futures type system. In
other words, these types must never block the thread, and instead the
current task is notified when the I/O resource is ready.
Standard input and output
Tokio provides asynchronous APIs to standard input, output, and error.
These APIs are very similar to the ones provided by std
, but they also
implement AsyncRead
and AsyncWrite
.
Unlike most other Tokio APIs, the standard input / output APIs must be used from the context of the Tokio runtime as they require Tokio specific features to function.
Utility functions
Utilities functions are provided for working with AsyncRead
/
AsyncWrite
types. For example, copy
asynchronously copies all
data from a source to a destination.
std
re-exports
Additionally, Read
, Write
, Error
, ErrorKind
, and
Result
are re-exported from std::io
for ease of use.
Structs
lines
method which is a stream over
the lines of text on an I/O object.AsyncRead::split
.AsyncRead::split
.Enums
Traits
Read
trait allows for reading bytes from a source.Functions
A
.buf
in asynchronous
manner, returning a future type.buf
,
returning an error if EOF is hit sooner.A
into the buffer provided.A
into the buffer provided until the delimiter byte
is reached.
This method is the async equivalent to BufRead::read_until
.buf
to
the stream a
provided.