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

no-std bitvec-nom2

Bit level parsing for nom with bitvec

1 unstable release

0.2.0 Jul 11, 2023

#196 in Parser tooling

Download history 1260/week @ 2024-01-02 786/week @ 2024-01-09 866/week @ 2024-01-16 2413/week @ 2024-01-23 1223/week @ 2024-01-30 1193/week @ 2024-02-06 1107/week @ 2024-02-13 1309/week @ 2024-02-20 1251/week @ 2024-02-27 2005/week @ 2024-03-05 1993/week @ 2024-03-12 1682/week @ 2024-03-19 1482/week @ 2024-03-26 2018/week @ 2024-04-02 1552/week @ 2024-04-09 1847/week @ 2024-04-16

7,169 downloads per month
Used in 21 crates (2 directly)

MIT license

14KB
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
~40K SLoC