#bitstream #endian #big-endian #little-endian #binary

bitstream-io

Library for reading/writing un-aligned values from/to streams in big-endian and little-endian formats

11 releases

new 0.6.5 Aug 8, 2018
0.6.3 Sep 27, 2017
0.6.1 Mar 27, 2017

#4 in #endian

Download history 56/week @ 2018-05-16 63/week @ 2018-05-23 88/week @ 2018-05-30 42/week @ 2018-06-06 84/week @ 2018-06-13 89/week @ 2018-06-20 134/week @ 2018-06-27 71/week @ 2018-07-04 63/week @ 2018-07-11 231/week @ 2018-07-18 90/week @ 2018-07-25 136/week @ 2018-08-01 176/week @ 2018-08-08

441 downloads per month

bitstream-io

A Rust library for reading or writing binary values to or from streams which may not be aligned at a whole byte.

This library is intended to be flexible enough to wrap around any stream which implements the Read or Write traits. It also supports a wide array of integer data types as containers for those binary values.

Documentation

Usage

Add this to your Cargo.toml:

[dependencies]
bitstream-io = "0.6"

and this to your crate root:

extern crate bitstream_io;

lib.rs:

Traits and helpers for bitstream handling functionality

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 the Read trait, and the only requirement for writer streams is that they must implement the Write 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.

MIT/Apache-2.0 license
  • No runtime deps

Reverse deps