#codec #async #future #networking #async-io

asynchronous-codec

Utilities for encoding and decoding frames using async/await

5 unstable releases

0.7.0 Oct 11, 2023
0.6.2 Jul 20, 2023
0.6.1 Nov 8, 2022
0.6.0 Feb 1, 2021
0.5.0 Jan 6, 2021

#74 in Asynchronous

Download history 97362/week @ 2024-07-23 91870/week @ 2024-07-30 97250/week @ 2024-08-06 107702/week @ 2024-08-13 95496/week @ 2024-08-20 108945/week @ 2024-08-27 114614/week @ 2024-09-03 101270/week @ 2024-09-10 104564/week @ 2024-09-17 107532/week @ 2024-09-24 116531/week @ 2024-10-01 107322/week @ 2024-10-08 113911/week @ 2024-10-15 104678/week @ 2024-10-22 99268/week @ 2024-10-29 102571/week @ 2024-11-05

441,010 downloads per month
Used in 510 crates (76 directly)

MIT license

53KB
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.8–1.5MB
~28K SLoC