Function cookie_factory::bytes::ne_u8

source ·
pub fn ne_u8<W: Write>(i: u8) -> impl SerializeFn<W>
Expand description

Writes an u8 to the output

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

let mut buf = [0u8; 100];

{
  let (buf, pos) = gen(ne_u8(1u8), &mut buf[..]).unwrap();
  assert_eq!(pos, 1);
  assert_eq!(buf.len(), 100 - 1);
}

assert_eq!(&buf[..1], &[1u8][..]);