Expand description

Port of bitstream_io for usage with tokio runtime

Traits and helpers for async bitstream handling functionality

Async Bitstream readers are for reading signed and unsigned integer values from a stream whose sizes may not be whole bytes. Bitstream writers are for writing signed and unsigned integer values to a stream, also potentially un-aligned at a whole byte.

Both big-endian and little-endian streams are supported.

The only requirement for wrapped reader streams is that they must implement tokio AsyncRead trait, and the only requirement for writer streams is that they must implement tokio AsyncWrite trait.

In addition, reader streams do not consume any more bytes from the underlying reader than necessary, buffering only a single partial byte as needed. Writer streams also write out all whole bytes as they are accumulated.

Readers and writers are also designed to work with integer types of any possible size. Many of Rust’s built-in integer types are supported by default.

Traits are implemented with async_trait macro that is re-exported from this library

Re-exports

pub use read::BitRead;
pub use read::BitReader;
pub use read::ByteRead;
pub use read::ByteReader;
pub use read::HuffmanRead;
pub use write::BitCounter;
pub use write::BitRecorder;
pub use write::BitWrite;
pub use write::BitWriter;
pub use write::ByteWrite;
pub use write::ByteWriter;
pub use write::HuffmanWrite;

Modules

Traits and implementations for reading or writing Huffman codes from or to a stream.
Traits and implementations for reading bits from a stream.
Traits and implementations for writing bits to a stream.

Structs

Big-endian, or most significant bits first
A queue for efficiently pushing bits onto a value and popping them off a value.
Little-endian, or least significant bits first

Traits

A stream’s endianness, or byte order, for determining how bits should be read.
This trait extends many common integer types (both unsigned and signed) with a few trivial methods so that they can be used with the bitstream handling traits.
This trait extends many common signed integer types so that they can be used with the bitstream handling traits.

Type Definitions

Big-endian, or most significant bits first
Little-endian, or least significant bits first

Attribute Macros