Function bits
fn bits<I, O, E1, E2, P>(parser: P) -> impl FnMut(I) -> crate::internal::IResult<I, O, E2>
where
E1: ParseError<(I, usize)> + ErrorConvert<E2>,
E2: ParseError<I>,
I: Input,
P: Parser<(I, usize), Output = O, Error = E1>
Converts a byte-level input to a bit-level input, for consumption by a parser that uses bits.
Afterwards, the input is converted back to a byte-level parser, with any remaining bits thrown away.
Example
use ;
use Error;
use IResult;
let input = &;
let output = parse.expect;
// The first byte is consumed, the second byte is partially consumed and dropped.
let remaining = output.0;
assert_eq!;
let parsed = output.1;
assert_eq!;
assert_eq!;