Module nom::bits
[−]
[src]
Bit level parsers and combinators
Bit parsing is handled by tweaking the input in most macros.
In byte level parsing, the input is generally a &[u8]
passed from combinator
to combinator until the slices are manipulated.
Bit parsers take a (&[u8], usize)
as input. The first part of the tuple is an byte slice,
the second part is a bit offset in the first byte of the slice.
By passing a pair like this, we can leverage most of the combinators, and avoid transforming the whole slice to a vector of booleans. This should make it easy to see a byte slice as a bit stream, and parse code points of arbitrary bit length.