Function nom::number::streaming::be_u8[][src]

pub fn be_u8<'a, E: ParseError<&'a [u8]>>(
    i: &'a [u8]
) -> IResult<&'a [u8], u8, E>

Recognizes an unsigned 1 byte integer

streaming version: will return Err(nom::Err::Incomplete(_)) if there is not enough data

use nom::number::streaming::be_u8;

let parser = be_u8::<(_, ErrorKind)>;

assert_eq!(parser(b"\x00\x01abcd"), Ok((&b"\x01abcd"[..], 0x00)));
assert_eq!(parser(b""), Err(Err::Incomplete(Needed::Size(1))));