combine::parser::byte::num

Function f32

Source
pub fn f32<'a, B, I>() -> F32<B, I>
where I: Stream<Item = u8>, I::Error: ParseError<I::Item, I::Range, I::Position>, B: ByteOrder,
Expand description

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

use combine::byteorder::{LE, ByteOrder};
use combine::Parser;
use combine::parser::byte::num::f32;

let mut buf = [0; 4];
LE::write_f32(&mut buf, 123.45);
assert_eq!(f32::<LE, _>().parse(&buf[..]), Ok((123.45, &b""[..])));
assert!(f32::<LE, _>().parse(&b"\x01\0\0"[..]).is_err());