[][src]Function cookie_factory::combinator::hex

pub fn hex<S: UpperHex, W: Write>(data: S) -> impl SerializeFn<W>

Writes an hex string to the output

use cookie_factory::{gen, combinator::hex};

let mut buf = [0u8; 100];

{
  let (buf, pos) = gen(hex(0x2A), &mut buf[..]).unwrap();
  assert_eq!(pos, 2);
  assert_eq!(buf.len(), 100 - 2);
}

assert_eq!(&buf[..2], &b"2A"[..]);