Crates.io | futures_codec |
lib.rs | futures_codec |
version | 0.4.1 |
source | src |
created_at | 2019-04-26 09:47:36.670475 |
updated_at | 2020-06-21 13:52:17.425058 |
description | Utilities for encoding and decoding frames using `async/await` |
homepage | https://github.com/matthunz/futures-codec |
repository | https://github.com/matthunz/futures-codec |
max_upload_size | |
id | 130289 |
size | 51,311 |
Utilities for encoding and decoding frames using async/await.
Contains adapters to go from streams of bytes, AsyncRead
and AsyncWrite
,
to framed streams implementing Sink
and Stream
. Framed streams are also known as transports.
use futures_codec::{LinesCodec, Framed};
async fn main() {
// let stream = ...
let mut framed = Framed::new(stream, LinesCodec {});
while let Some(line) = framed.try_next().await.unwrap() {
println!("{:?}", line);
}
}