bitio_rs/traits.rs
1pub trait BitRead {
2 type Output;
3
4 /// Reads exactly `n` bits, consuming them from the stream
5 fn read_bits(&mut self, n: usize) -> std::io::Result<Self::Output>;
6}
7
8pub trait BitPeek {
9 type Output;
10
11 /// Peeks at the next `n` bits without consuming
12 fn peek_bits(&mut self, n: usize) -> std::io::Result<Self::Output>;
13}
14
15pub trait BitWrite {
16 fn write_bits(&mut self, value: u64, n: usize) -> std::io::Result<()>;
17}