#nom #bit #parser #parser-combinator

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

#131 in Parser tooling

Download history 123407/week @ 2025-10-13 137159/week @ 2025-10-20 153000/week @ 2025-10-27 155276/week @ 2025-11-03 143785/week @ 2025-11-10 142897/week @ 2025-11-17 73399/week @ 2025-11-24 44618/week @ 2025-12-01 37630/week @ 2025-12-08 36715/week @ 2025-12-15 20471/week @ 2025-12-22 19204/week @ 2025-12-29 42768/week @ 2026-01-05 39774/week @ 2026-01-12 25647/week @ 2026-01-19 24807/week @ 2026-01-26

135,739 downloads per month
Used in 62 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