Available on crate feature
io
only.Expand description
Helpers for IO related tasks.
The stream types are often used in combination with hyper or reqwest, as they
allow converting between a hyper Body
and AsyncRead
.
The SyncIoBridge
type converts from the world of async I/O
to synchronous I/O; this may often come up when using synchronous APIs
inside tokio::task::spawn_blocking
.
Structs§
- Copy
ToBytes - A helper that wraps a
Sink
<
Bytes
>
and converts it into aSink
<&'a [u8]>
by copying each byte slice into an ownedBytes
. - Inspect
Reader - An adapter that lets you inspect the data that’s being read.
- Inspect
Writer - An adapter that lets you inspect the data that’s being written.
- Reader
Stream - Convert an
AsyncRead
into aStream
of byte chunks. - Sink
Writer - Convert a
Sink
of byte chunks into anAsyncWrite
. - Stream
Reader - Convert a
Stream
of byte chunks into anAsyncRead
. - Sync
IoBridge io-util
- Use a
tokio::io::AsyncRead
synchronously as astd::io::Read
or atokio::io::AsyncWrite
as astd::io::Write
.
Functions§
- poll_
read_ buf - Try to read data from an
AsyncRead
into an implementer of theBufMut
trait. - poll_
write_ buf - Try to write data from an implementer of the
Buf
trait to anAsyncWrite
, advancing the buffer’s internal cursor. - read_
buf - Read data from an
AsyncRead
into an implementer of theBufMut
trait.