#future #futures #async #codec

asynchronous-codec

Utilities for encoding and decoding frames using async/await

2 unstable releases

0.6.0 Feb 1, 2021
0.5.0 Jan 6, 2021

#77 in Asynchronous

Download history 23/week @ 2021-01-04 1194/week @ 2021-01-11 3689/week @ 2021-01-18 7213/week @ 2021-01-25 9526/week @ 2021-02-01 9677/week @ 2021-02-08 12568/week @ 2021-02-15 17527/week @ 2021-02-22

4,349 downloads per month
Used in 27 crates (8 directly)

MIT license

48KB
1K SLoC

Asynchronous Codec

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.

Latest Version Rust Documentation LICENSE

Example

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);
    }
}

Dependencies

~0.9–1.3MB
~27K SLoC