bits_io/
bit_types.rs

1pub trait BitStore: bitvec::store::BitStore {}
2
3impl BitStore for u8 {}
4impl BitStore for bitvec::access::BitSafeU8 {}
5
6pub type BitSlice<O = u8> = bitvec::slice::BitSlice<O, bitvec::order::Msb0>;
7
8pub type BitVec = bitvec::vec::BitVec<u8, bitvec::order::Msb0>;
9
10#[macro_export]
11macro_rules! bits {
12    ($($bit:expr),* $(,)?) => {
13        bitvec::bits!(u8, bitvec::order::Msb0; $($bit),*)
14    };
15}
16
17#[macro_export]
18macro_rules! bitvec {
19    // Repeat value form: bitvec_u8![value; len]
20    ($value:expr; $len:expr) => {
21        bitvec::bitvec!(u8, bitvec::order::Msb0; $value; $len)
22    };
23    // List of explicit bits: bitvec_u8![1, 0, 1, 1]
24    ($($bit:expr),* $(,)?) => {
25        bitvec::bitvec!(u8, bitvec::order::Msb0; $($bit),*)
26    };
27
28}