mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-09-25 12:00:35 +00:00
io: refer to ReaderStream
and StreamReader
in module docs (#5576)
This commit is contained in:
parent
54a394696f
commit
768ede65c1
@ -130,19 +130,23 @@
|
||||
//! other words, these types must never block the thread, and instead the
|
||||
//! current task is notified when the I/O resource is ready.
|
||||
//!
|
||||
//! ## Conversion to and from Sink/Stream
|
||||
//! ## Conversion to and from Stream/Sink
|
||||
//!
|
||||
//! It is often convenient to encapsulate the reading and writing of
|
||||
//! bytes and instead work with a [`Sink`] or [`Stream`] of some data
|
||||
//! type that is encoded as bytes and/or decoded from bytes. Tokio
|
||||
//! provides some utility traits in the [tokio-util] crate that
|
||||
//! abstract the asynchronous buffering that is required and allows
|
||||
//! you to write [`Encoder`] and [`Decoder`] functions working with a
|
||||
//! buffer of bytes, and then use that ["codec"] to transform anything
|
||||
//! that implements [`AsyncRead`] and [`AsyncWrite`] into a `Sink`/`Stream` of
|
||||
//! your structured data.
|
||||
//! It is often convenient to encapsulate the reading and writing of bytes in a
|
||||
//! [`Stream`] or [`Sink`] of data.
|
||||
//!
|
||||
//! [tokio-util]: https://docs.rs/tokio-util/0.6/tokio_util/codec/index.html
|
||||
//! Tokio provides simple wrappers for converting [`AsyncRead`] to [`Stream`]
|
||||
//! and vice-versa in the [tokio-util] crate, see [`ReaderStream`] and
|
||||
//! [`StreamReader`].
|
||||
//!
|
||||
//! There are also utility traits that abstract the asynchronous buffering
|
||||
//! necessary to write your own adaptors for encoding and decoding bytes to/from
|
||||
//! your structured data, allowing to transform something that implements
|
||||
//! [`AsyncRead`]/[`AsyncWrite`] into a [`Stream`]/[`Sink`], see [`Decoder`] and
|
||||
//! [`Encoder`] in the [tokio-util::codec] module.
|
||||
//!
|
||||
//! [tokio-util]: https://docs.rs/tokio-util
|
||||
//! [tokio-util::codec]: https://docs.rs/tokio-util/latest/tokio_util/codec/index.html
|
||||
//!
|
||||
//! # Standard input and output
|
||||
//!
|
||||
@ -167,9 +171,11 @@
|
||||
//! [`AsyncWrite`]: trait@AsyncWrite
|
||||
//! [`AsyncReadExt`]: trait@AsyncReadExt
|
||||
//! [`AsyncWriteExt`]: trait@AsyncWriteExt
|
||||
//! ["codec"]: https://docs.rs/tokio-util/0.6/tokio_util/codec/index.html
|
||||
//! [`Encoder`]: https://docs.rs/tokio-util/0.6/tokio_util/codec/trait.Encoder.html
|
||||
//! [`Decoder`]: https://docs.rs/tokio-util/0.6/tokio_util/codec/trait.Decoder.html
|
||||
//! ["codec"]: https://docs.rs/tokio-util/latest/tokio_util/codec/index.html
|
||||
//! [`Encoder`]: https://docs.rs/tokio-util/latest/tokio_util/codec/trait.Encoder.html
|
||||
//! [`Decoder`]: https://docs.rs/tokio-util/latest/tokio_util/codec/trait.Decoder.html
|
||||
//! [`ReaderStream`]: https://docs.rs/tokio-util/latest/tokio_util/io/struct.ReaderStream.html
|
||||
//! [`StreamReader`]: https://docs.rs/tokio-util/latest/tokio_util/io/struct.StreamReader.html
|
||||
//! [`Error`]: struct@Error
|
||||
//! [`ErrorKind`]: enum@ErrorKind
|
||||
//! [`Result`]: type@Result
|
||||
|
Loading…
x
Reference in New Issue
Block a user