#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

#42 in Parser tooling

Download history 41350/week @ 2024-08-22 16909/week @ 2024-08-29 24765/week @ 2024-09-05 32105/week @ 2024-09-12 29969/week @ 2024-09-19 34494/week @ 2024-09-26 33318/week @ 2024-10-03 25509/week @ 2024-10-10 34666/week @ 2024-10-17 38041/week @ 2024-10-24 40476/week @ 2024-10-31 32521/week @ 2024-11-07 42780/week @ 2024-11-14 66401/week @ 2024-11-21 40025/week @ 2024-11-28 52181/week @ 2024-12-05

207,223 downloads per month
Used in 35 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