combine::parser::byte::num

Function be_u32

Source
pub fn be_u32<'a, I>() -> U32<BE, I>
where I: Stream<Item = u8>, I::Error: ParseError<I::Item, I::Range, I::Position>,
Expand description

Reads a u32 out of the byte stream with the specified endianess

use combine::byteorder::LE;
use combine::Parser;
use combine::parser::byte::num::u32;

assert_eq!(u32::<LE, _>().parse(&b"\x01\0\0\0"[..]), Ok((1, &b""[..])));
assert!(u32::<LE, _>().parse(&b"\x01\0\0"[..]).is_err());