#codec #future #async #frame #async-await #decoding #framed

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

#24 in Asynchronous

Download history 29580/week @ 2023-12-23 42643/week @ 2023-12-30 64572/week @ 2024-01-06 84326/week @ 2024-01-13 84648/week @ 2024-01-20 89167/week @ 2024-01-27 90202/week @ 2024-02-03 88543/week @ 2024-02-10 88842/week @ 2024-02-17 83664/week @ 2024-02-24 83484/week @ 2024-03-02 86050/week @ 2024-03-09 96813/week @ 2024-03-16 91804/week @ 2024-03-23 108279/week @ 2024-03-30 95192/week @ 2024-04-06

407,494 downloads per month
Used in 416 crates (69 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.9–1.6MB
~29K SLoC