5个不稳定版本
0.7.0 | 2023年10月11日 |
---|---|
0.6.2 | 2023年7月20日 |
0.6.1 | 2022年11月8日 |
0.6.0 | 2021年2月1日 |
0.5.0 | 2021年1月6日 |
#84 in 异步
326,153 每月下载量
用于 434 个crate(69 个直接使用)
53KB
1K SLoC
异步编解码器
使用 async/await 编码和解码帧的实用工具。
这是由 futures-codec
(作者:Matt Hunzinger)的分支,从 tokio-codec
中借用了许多概念。
包含适配器,可以将字节数据流、AsyncRead
和 AsyncWrite
转换为实现 Sink
和 Stream
的帧流。帧流也称为传输。
示例
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);
}
}
依赖项
~0.9–1.6MB
~29K SLoC