Function cookie_factory::bytes::be_i8

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

Writes an i8 to the output

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

let mut buf = [0u8; 100];

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

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