Crate async_bincode

source ·
Expand description

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.

This crate provides two sets of types in two separate modules. The types in the futures module work with the futures_io/async-std ecosystem. The types in the tokio module work with the tokio ecosystem.

Re-exports

  • pub use crate::writer::BincodeWriterFor;

Modules

Structs

  • A marker that indicates that the wrapping type is compatible with AsyncBincodeReader.
  • A marker that indicates that the wrapping type is compatible with stock bincode receivers.