Function rocket::mtls::oid::asn1_rs::nom::bits::streaming::bool

source ·
pub fn bool<I, E>(input: (I, usize)) -> Result<((I, usize), bool), Err<E>>
where E: ParseError<(I, usize)>, I: Slice<RangeFrom<usize>> + InputIter<Item = u8> + InputLength,
Available on crate feature mtls only.
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)));