| Crates.io | endio_bit |
| lib.rs | endio_bit |
| version | 0.2.0 |
| created_at | 2019-02-26 16:08:30.36559+00 |
| updated_at | 2020-04-05 12:03:19.807304+00 |
| description | Bit-level reading and writing, modeled after std::io::{BufReader, BufWriter}. |
| homepage | |
| repository | https://github.com/lcdr/endio_bit/ |
| max_upload_size | |
| id | 117394 |
| size | 33,723 |
std::io::{Read, Write} only allow reading and writing on the byte-level. This is not sufficient when working with protocols that use single bits or use structs that are not multiples of 8 bits in size. This crate provides wrappers for reading and writing, enabling bit-level I/O on any object implementing Read/Write.
The wrappers are modeled after std::io::BufReader and std::io::BufWriter, so the semantics and interface should be familiar and robust.
This crate is a minimal low-level abstraction focusing on bit-level I/O. I recommend using this crate together with endio if you also need byte-level I/O or (de-)serialization support. However, this crate is completely independent from endio, and can be used standalone if you're only looking for std::io with bit support.
endio in combination with this crate.endio in combination with this crate.Bit-level I/O is a common problem, and there are numerous crates on crates.io attempting to provide solutions. However, I haven't been able to find one that is completely satisfactory. Here's a list of related crates and how they differ from this one:
av-bitstream - Includes (de-)serialization and byte endianness. No bit-level writing. Undocumented.
bit-io - Does not implement std::io::{Read, Write}. No support for bit endianness. Undocumented.
bitio - No support for writing. No support for bit endianness.
bitstream, bitstream_reader, bitter - Include (de-)serialization and byte endianness. No support for writing.
bitstream-io - Includes (de-)serialization and byte endianness. Includes Huffman trees for some reason. Does not implement std::io::{Read, Write}.
bitstream-rs - Only has support for reading and writing single bits. Does not implement std::io::{Read, Write}.
bitreader - Only has support for reading. Includes deserialization in forced big endian, no little endian support.
Therefore there is an opportunity to improve on the current library situation, which I hope to address through this crate.