#nom

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

#425 in Parser implementations

Download history 33613/week @ 2024-07-13 34128/week @ 2024-07-20 36303/week @ 2024-07-27 24605/week @ 2024-08-03 48393/week @ 2024-08-10 43645/week @ 2024-08-17 20724/week @ 2024-08-24 22118/week @ 2024-08-31 25583/week @ 2024-09-07 31873/week @ 2024-09-14 29409/week @ 2024-09-21 33824/week @ 2024-09-28 34502/week @ 2024-10-05 25358/week @ 2024-10-12 36161/week @ 2024-10-19 33018/week @ 2024-10-26

134,382 downloads per month
Used in 31 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