[][src]Function cookie_factory::bytes::ne_f64

pub fn ne_f64<W: Write>(i: f64) -> impl SerializeFn<W>

Writes an f64 in native byte order to the output

use cookie_factory::{gen, bytes::ne_f64};

let mut buf = [0u8; 100];

{
  let (buf, pos) = gen(ne_f64(1.0f64), &mut buf[..]).unwrap();
  assert_eq!(pos, 8);
  assert_eq!(buf.len(), 100 - 8);
}

#[cfg(target_endian = "big")]
assert_eq!(&buf[..8], &[63u8, 240u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8][..]);
#[cfg(target_endian = "little")]
assert_eq!(&buf[..8], &[0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 240u8, 63u8][..]);