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