27 releases

0.7.2 Nov 11, 2023
0.7.1 Apr 30, 2023
0.7.0 May 8, 2022
0.6.1 Feb 25, 2021
0.4.5 Jul 9, 2018

#129 in Encoding

Download history 1197/week @ 2023-11-23 846/week @ 2023-11-30 1251/week @ 2023-12-07 1116/week @ 2023-12-14 883/week @ 2023-12-21 568/week @ 2023-12-28 1579/week @ 2024-01-04 1040/week @ 2024-01-11 1615/week @ 2024-01-18 1008/week @ 2024-01-25 1374/week @ 2024-02-01 1503/week @ 2024-02-08 1255/week @ 2024-02-15 1560/week @ 2024-02-22 770/week @ 2024-02-29 423/week @ 2024-03-07

4,181 downloads per month
Used in 12 crates (8 directly)

MIT/Apache

35KB
582 lines

async-bincode

Crates.io Documentation

Asynchronous access to a bincode-encoded item stream.

This crate enables you to asynchronously read from a bincode-encoded stream, or write bincoded-encoded values. bincode does not support this natively, as it cannot easily resume from stream errors while encoding or decoding.

async-bincode works around that on the receive side by buffering received bytes until a full element's worth of data has been received, and only then calling into bincode. To make this work, it relies on the sender to prefix each encoded element with its encoded size.

On the write side, async-bincode buffers the serialized values, and asynchronously sends the resulting bytestream. Important: Only one element at a time is written to the output writer. It is recommended to use a BufWriter in front of the output to batch write operations to the underlying writer. The marker trait AsyncDestination can be used to automatically add the length prefix required by an async-bincode receiver.

Dependencies

~3–13MB
~123K SLoC