| 1 | # futures_codec |
| 2 | |
| 3 | Utilities for encoding and decoding frames using async/await. |
| 4 | |
| 5 | Contains adapters to go from streams of bytes, `AsyncRead` and `AsyncWrite`, |
| 6 | to framed streams implementing `Sink` and `Stream`. Framed streams are also known as transports. |
| 7 | |
| 8 | [](https://crates.io/crates/futures-codec) |
| 9 | [](https://docs.rs/futures-codec) |
| 10 | [](https://travis-ci.com/matthunz/futures-codec) |
| 11 |  |
| 12 | |
| 13 | |
| 14 | ### Example |
| 15 | ```rust |
| 16 | use futures_codec::{LinesCodec, Framed}; |
| 17 | |
| 18 | async fn main() { |
| 19 | // let stream = ... |
| 20 | let mut framed = Framed::new(stream, LinesCodec {}); |
| 21 | |
| 22 | while let Some(line) = framed.try_next().await.unwrap() { |
| 23 | println!("{:?}", line); |
| 24 | } |
| 25 | } |
| 26 | ``` |