pub fn string<S: AsRef<str>, W: Write>(data: S) -> impl SerializeFn<W>
Expand description

Writes a string slice to the output

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

let mut buf = [0u8; 100];

{
  let (buf, pos) = gen(string("abcd"), &mut buf[..]).unwrap();
  assert_eq!(pos, 4);
  assert_eq!(buf.len(), 100 - 4);
}

assert_eq!(&buf[..4], &b"abcd"[..]);