bitio-rs 0.1.1

🚀A lightweight Rust library for bit-level I/O: read, peek, write, with both big-endian and little-endian support.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
pub trait BitRead {
    type Output;

    /// Reads exactly `n` bits, consuming them from the stream
    fn read_bits(&mut self, n: usize) -> std::io::Result<Self::Output>;
}

pub trait BitPeek {
    type Output;

    /// Peeks at the next `n` bits without consuming
    fn peek_bits(&mut self, n: usize) -> std::io::Result<Self::Output>;
}

pub trait BitWrite {
    fn write_bits(&mut self, value: u64, n: usize) -> std::io::Result<()>;
}