#nom #parser-combinator #bit-level #bit #parser

no-std bitvec-nom2

Bit level parsing for nom with bitvec

2 releases

0.2.1 Aug 28, 2024
0.2.0 Jul 11, 2023

#40 in Parser tooling

Download history 23618/week @ 2024-08-04 47318/week @ 2024-08-11 45455/week @ 2024-08-18 18315/week @ 2024-08-25 24013/week @ 2024-09-01 25400/week @ 2024-09-08 31566/week @ 2024-09-15 29652/week @ 2024-09-22 33240/week @ 2024-09-29 34246/week @ 2024-10-06 26032/week @ 2024-10-13 36733/week @ 2024-10-20 40233/week @ 2024-10-27 43368/week @ 2024-11-03 32691/week @ 2024-11-10 45830/week @ 2024-11-17

164,743 downloads per month
Used in 33 crates (2 directly)

MIT license

15KB
341 lines

nom-bitvec

LICENSE Join the chat at https://gitter.im/Geal/nom Crates.io Version Minimum rustc version

This crate provides input types for nom parser combinators using bitvec. With those, you can use common nom combinators directly on streams of bits.

Example

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..])));

Dependencies

~2MB
~41K SLoC