#codec #async-io #decode #decoding #frame #encode #byte

dencode

Utilities for decoding and encoding frames from readers and writers

2 unstable releases

0.3.0 May 18, 2021
0.2.0 May 18, 2021
0.1.0 Dec 24, 2020

#2066 in Encoding

Download history 488/week @ 2024-07-20 664/week @ 2024-07-27 541/week @ 2024-08-03 411/week @ 2024-08-10 227/week @ 2024-08-17 366/week @ 2024-08-24 444/week @ 2024-08-31 311/week @ 2024-09-07 306/week @ 2024-09-14 240/week @ 2024-09-21 479/week @ 2024-09-28 529/week @ 2024-10-05 511/week @ 2024-10-12 501/week @ 2024-10-19 317/week @ 2024-10-26 510/week @ 2024-11-02

1,937 downloads per month
Used in 3 crates (2 directly)

MIT license

37KB
782 lines

dencode

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.

Latest Version Rust Documentation LICENSE

Example

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

Prior Art

Dependencies

~135–500KB