| Crates.io | dencode |
| lib.rs | dencode |
| version | 0.3.0 |
| created_at | 2020-12-24 00:36:03.912691+00 |
| updated_at | 2021-05-18 21:16:24.85167+00 |
| description | Utilities for decoding and encoding frames from readers and writers. |
| homepage | https://github.com/swift-nav/dencode |
| repository | https://github.com/swift-nav/dencode |
| max_upload_size | |
| id | 326763 |
| size | 50,703 |
Utilities for encoding and decoding frames with support for synchronous and asynchronous io.
Contains adapters to go from streams of bytes, Read/AsyncRead and Write/AsyncWrite, to framed iterators/streams.
use dencode::{LinesCodec, Framed};
async fn main() {
// Synchronous
// let reader = ...
let mut framed = Framed::new(read, LinesCodec {});
for frame in framed {
println!("{:?}", frame);
}
// Asynchronous
// let stream = ...
let mut framed = Framed::new(stream, LinesCodec {});
while let Some(line) = framed.try_next().await.unwrap() {
println!("{:?}", line);
}
}