Macro nom::u64[][src]

macro_rules! u64 {
    ($i:expr, $e:expr) => { ... };
}

if the parameter is nom::Endianness::Big, parse a big endian u64 integer, otherwise a little endian u64 integer

use nom::number::Endianness;

named!(be<u64>, u64!(Endianness::Big));

assert_eq!(be(b"\x00\x01\x02\x03\x04\x05\x06\x07abcd"), Ok((&b"abcd"[..], 0x0001020304050607)));
assert_eq!(be(b"\x01"), Err(Err::Incomplete(Needed::Size(8))));

named!(le<u64>, u64!(Endianness::Little));

assert_eq!(le(b"\x00\x01\x02\x03\x04\x05\x06\x07abcd"), Ok((&b"abcd"[..], 0x0706050403020100)));
assert_eq!(le(b"\x01"), Err(Err::Incomplete(Needed::Size(8))));