| Crates.io | nom-bitvec |
| lib.rs | nom-bitvec |
| version | 0.2.0 |
| created_at | 2021-07-18 12:59:30.331936+00 |
| updated_at | 2021-08-21 11:09:11.91109+00 |
| description | Bit level parsing for nom with bitvec |
| homepage | |
| repository | https://github.com/rust-bakery/nom-bitvec |
| max_upload_size | |
| id | 424376 |
| size | 14,471 |
This crate provides input types for nom parser combinators using bitvec. With those, you can use common nom combinators directly on streams of bits.
let data = [0xA5u8, 0x69, 0xF0, 0xC3];
let bits = data.view_bits::<Msb0>();
fn parser(bits: &BitSlice<Msb0, u8>) -> IResult<&BitSlice<Msb0, u8>, &BitSlice<Msb0, u8>> {
tag(bits![1, 0, 1, 0])(bits)
}
assert_eq!(parser(bits), Ok((&bits[..4], &bits[4..])));