Function cookie_factory::multi::all

source ·
pub fn all<G, W: Write, It>(values: It) -> impl SerializeFn<W>
where G: SerializeFn<W>, It: Clone + Iterator<Item = G>,
Expand description

Applies an iterator of serializers of the same type

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

let mut buf = [0u8; 100];

let data = vec!["abcd", "efgh", "ijkl"];
{
  let (buf, pos) = gen(all(data.iter().map(string)), &mut buf[..]).unwrap();
  assert_eq!(pos, 12);
  assert_eq!(buf.len(), 100 - 12);
}

assert_eq!(&buf[..12], &b"abcdefghijkl"[..]);