https://github.com/libp2p/rust-asynchronous-codec
Utilities for encoding and decoding frames using `async/await`.
https://github.com/libp2p/rust-asynchronous-codec
async-await encoding networking
Last synced: 11 months ago
JSON representation
Utilities for encoding and decoding frames using `async/await`.
- Host: GitHub
- URL: https://github.com/libp2p/rust-asynchronous-codec
- Owner: libp2p
- License: mit
- Created: 2021-01-06T10:50:59.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2025-07-09T02:55:10.000Z (12 months ago)
- Last Synced: 2025-08-04T07:33:30.556Z (11 months ago)
- Topics: async-await, encoding, networking
- Language: Rust
- Homepage:
- Size: 146 KB
- Stars: 28
- Watchers: 1
- Forks: 8
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Asynchronous Codec
Utilities for encoding and decoding frames using async/await.
This is a fork of [`futures-codec`](https://github.com/matthunz/futures-codec)
by [Matt Hunzinger](https://github.com/matthunz) borrowing many concepts from
[`tokio-codec`](https://crates.io/crates/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.
[](https://crates.io/crates/asynchronous-codec)
[](https://docs.rs/asynchronous-codec)

### Example
```rust
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);
}
}
```