Function cookie_factory::bytes::le_u64
source · pub fn le_u64<W: Write>(i: u64) -> impl SerializeFn<W>
Expand description
Writes an u64
in little endian byte order to the output
use cookie_factory::{gen, bytes::le_u64};
let mut buf = [0u8; 100];
{
let (buf, pos) = gen(le_u64(1u64), &mut buf[..]).unwrap();
assert_eq!(pos, 8);
assert_eq!(buf.len(), 100 - 8);
}
assert_eq!(&buf[..8], &[1u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8][..]);