|
130 | 130 | //! other words, these types must never block the thread, and instead the |
131 | 131 | //! current task is notified when the I/O resource is ready. |
132 | 132 | //! |
133 | | -//! ## Conversion to and from Sink/Stream |
| 133 | +//! ## Conversion to and from Stream/Sink |
134 | 134 | //! |
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. |
144 | 137 | //! |
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 |
146 | 150 | //! |
147 | 151 | //! # Standard input and output |
148 | 152 | //! |
|
167 | 171 | //! [`AsyncWrite`]: trait@AsyncWrite |
168 | 172 | //! [`AsyncReadExt`]: trait@AsyncReadExt |
169 | 173 | //! [`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 |
173 | 179 | //! [`Error`]: struct@Error |
174 | 180 | //! [`ErrorKind`]: enum@ErrorKind |
175 | 181 | //! [`Result`]: type@Result |
|
0 commit comments