Skip to content

Commit 768ede6

Browse files
authored
io: refer to ReaderStream and StreamReader in module docs (#5576)
1 parent 54a3946 commit 768ede6

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

tokio/src/io/mod.rs

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -130,19 +130,23 @@
130130
//! other words, these types must never block the thread, and instead the
131131
//! current task is notified when the I/O resource is ready.
132132
//!
133-
//! ## Conversion to and from Sink/Stream
133+
//! ## Conversion to and from Stream/Sink
134134
//!
135-
//! It is often convenient to encapsulate the reading and writing of
136-
//! bytes and instead work with a [`Sink`] or [`Stream`] of some data
137-
//! type that is encoded as bytes and/or decoded from bytes. Tokio
138-
//! provides some utility traits in the [tokio-util] crate that
139-
//! abstract the asynchronous buffering that is required and allows
140-
//! you to write [`Encoder`] and [`Decoder`] functions working with a
141-
//! buffer of bytes, and then use that ["codec"] to transform anything
142-
//! that implements [`AsyncRead`] and [`AsyncWrite`] into a `Sink`/`Stream` of
143-
//! your structured data.
135+
//! It is often convenient to encapsulate the reading and writing of bytes in a
136+
//! [`Stream`] or [`Sink`] of data.
144137
//!
145-
//! [tokio-util]: https://docs.rs/tokio-util/0.6/tokio_util/codec/index.html
138+
//! Tokio provides simple wrappers for converting [`AsyncRead`] to [`Stream`]
139+
//! and vice-versa in the [tokio-util] crate, see [`ReaderStream`] and
140+
//! [`StreamReader`].
141+
//!
142+
//! There are also utility traits that abstract the asynchronous buffering
143+
//! necessary to write your own adaptors for encoding and decoding bytes to/from
144+
//! your structured data, allowing to transform something that implements
145+
//! [`AsyncRead`]/[`AsyncWrite`] into a [`Stream`]/[`Sink`], see [`Decoder`] and
146+
//! [`Encoder`] in the [tokio-util::codec] module.
147+
//!
148+
//! [tokio-util]: https://docs.rs/tokio-util
149+
//! [tokio-util::codec]: https://docs.rs/tokio-util/latest/tokio_util/codec/index.html
146150
//!
147151
//! # Standard input and output
148152
//!
@@ -167,9 +171,11 @@
167171
//! [`AsyncWrite`]: trait@AsyncWrite
168172
//! [`AsyncReadExt`]: trait@AsyncReadExt
169173
//! [`AsyncWriteExt`]: trait@AsyncWriteExt
170-
//! ["codec"]: https://docs.rs/tokio-util/0.6/tokio_util/codec/index.html
171-
//! [`Encoder`]: https://docs.rs/tokio-util/0.6/tokio_util/codec/trait.Encoder.html
172-
//! [`Decoder`]: https://docs.rs/tokio-util/0.6/tokio_util/codec/trait.Decoder.html
174+
//! ["codec"]: https://docs.rs/tokio-util/latest/tokio_util/codec/index.html
175+
//! [`Encoder`]: https://docs.rs/tokio-util/latest/tokio_util/codec/trait.Encoder.html
176+
//! [`Decoder`]: https://docs.rs/tokio-util/latest/tokio_util/codec/trait.Decoder.html
177+
//! [`ReaderStream`]: https://docs.rs/tokio-util/latest/tokio_util/io/struct.ReaderStream.html
178+
//! [`StreamReader`]: https://docs.rs/tokio-util/latest/tokio_util/io/struct.StreamReader.html
173179
//! [`Error`]: struct@Error
174180
//! [`ErrorKind`]: enum@ErrorKind
175181
//! [`Result`]: type@Result

0 commit comments

Comments
 (0)