combine::parser::byte::num

Function be_f32

source
pub fn be_f32<'a, Input>() -> impl Parser<Input, Output = f32, PartialState = ()>
where Input: Stream<Token = u8>,
Expand description

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

use combine::Parser;
use combine::parser::byte::num::le_f32;

let buf = 123.45f32.to_le_bytes();
assert_eq!(le_f32().parse(&buf[..]), Ok((123.45, &b""[..])));
assert!(le_f32().parse(&b"\x01\0\0"[..]).is_err());