Crates.io | asynchronous-codec |
lib.rs | asynchronous-codec |
version | 0.7.0 |
source | src |
created_at | 2021-01-06 11:13:16.160991 |
updated_at | 2023-10-11 16:03:12.245241 |
description | Utilities for encoding and decoding frames using `async/await` |
homepage | https://github.com/mxinden/asynchronous-codec |
repository | https://github.com/mxinden/asynchronous-codec |
max_upload_size | |
id | 333037 |
size | 66,818 |
Utilities for encoding and decoding frames using async/await.
This is a fork of futures-codec
by Matt Hunzinger borrowing many concepts from
tokio-codec
.
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 asynchronous_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);
}
}