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