bitvec-nom2

Crates.iobitvec-nom2
lib.rsbitvec-nom2
version0.2.1
sourcesrc
created_at2023-07-11 14:53:11.957982
updated_at2024-08-28 07:16:24.193714
descriptionBit level parsing for nom with bitvec
homepage
repositoryhttps://github.com/rust-bakery/nom-bitvec
max_upload_size
id913898
size23,320
(XAMPPRocky)

documentation

https://docs.rs/nom-bitvec

README

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..])));
Commit count: 15

cargo fmt