kvarn::prelude::utils

Function join

source
pub fn join<S, I>(iter: I, separator: impl AsRef<str>) -> String
where S: AsRef<str>, I: Iterator<Item = S> + Clone,
Expand description

Joins the items in iter with a separator using 1 allocation.

separator can be "" to concatenate the items of iter.

This will Clone iter, as we need to count the length of the strings in iter and then use them. This should be cheap for most iterators.