pub fn bool<I, E: ParseError<(I, usize)>>(
input: (I, usize),
) -> IResult<(I, usize), bool, E>
Expand description
Parses one specific bit as a bool.
ยงExample
fn parse(input: (&[u8], usize)) -> IResult<(&[u8], usize), bool> {
bool(input)
}
assert_eq!(parse(([0b10000000].as_ref(), 0)), Ok((([0b10000000].as_ref(), 1), true)));
assert_eq!(parse(([0b10000000].as_ref(), 1)), Ok((([0b10000000].as_ref(), 2), false)));