[go: up one dir, main page]

[][src]Function combine::parser::byte::num::i16

pub fn i16<'a, B, Input>() -> I16<B, Input> where
    Input: Stream<Token = u8>,
    Input::Error: ParseError<Input::Token, Input::Range, Input::Position>,
    B: ByteOrder

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

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

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