Function combine::byte::num::le_i16 [] [src]

pub fn le_i16<'a, I>() -> I16<LE, I> where
    I: RangeStream<Range = &'a [u8]>,
    I::Error: ParseError<I::Item, I::Range, I::Position>, 

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

use combine::byteorder::LE;
use combine::Parser;
use combine::byte::num::i16;

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