#codec #decode #encode #frame #async-io #decoding #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

#2043 in Encoding

Download history 369/week @ 2024-03-14 375/week @ 2024-03-21 359/week @ 2024-03-28 553/week @ 2024-04-04 388/week @ 2024-04-11 269/week @ 2024-04-18 242/week @ 2024-04-25 456/week @ 2024-05-02 270/week @ 2024-05-09 464/week @ 2024-05-16 365/week @ 2024-05-23 249/week @ 2024-05-30 368/week @ 2024-06-06 348/week @ 2024-06-13 272/week @ 2024-06-20 272/week @ 2024-06-27

1,301 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

~130–510KB