Function cookie_factory::multi::separated_list
source · pub fn separated_list<F, G, W: Write, It>(
sep: F,
values: It
) -> impl SerializeFn<W>
Expand description
Applies an iterator of serializers of the same type with a separator between each serializer
use cookie_factory::{gen, multi::separated_list, combinator::string};
let mut buf = [0u8; 100];
let data = vec!["abcd", "efgh", "ijkl"];
{
let (buf, pos) = gen(separated_list(string(","), data.iter().map(string)), &mut buf[..]).unwrap();
assert_eq!(pos, 14);
assert_eq!(buf.len(), 100 - 14);
}
assert_eq!(&buf[..14], &b"abcd,efgh,ijkl"[..]);