Macro nom::i32 [−][src]
if the parameter is nom::Endianness::Big, parse a big endian i32 integer, otherwise a little endian i32 integer
use nom::number::Endianness; named!(be<i32>, i32!(Endianness::Big)); assert_eq!(be(b"\x00\x01\x02\x03abcd"), Ok((&b"abcd"[..], 0x00010203))); assert_eq!(be(b"\x01"), Err(Err::Incomplete(Needed::Size(4)))); named!(le<i32>, i32!(Endianness::Little)); assert_eq!(le(b"\x00\x01\x02\x03abcd"), Ok((&b"abcd"[..], 0x03020100))); assert_eq!(le(b"\x01"), Err(Err::Incomplete(Needed::Size(4))));