Function fmty::join

source ·
pub fn join<I, S>(iter: I, sep: S) -> Join<I::IntoIter, S>where
    I: IntoIterator,
    I::IntoIter: Clone,
Expand description

Concatenates Iterator items with a separator between each.

This may be used as a non-allocating alternative to [T]::join() or itertools::join().

If Clone for the Iterator is too expensive, consider using join_once().

Examples

let value = fmty::join(["hola", "mundo"], " ");
assert_eq!(value.to_string(), "hola mundo");