pub fn join_map<I, S, R, F>(iter: I, sep: S, f: F) -> JoinMap<I::IntoIter, S, F>where
I: IntoIterator,
I::IntoIter: Clone,
F: Fn(I::Item) -> R,
Expand description
Concatenates mapped Iterator
results with a separator between each.
Unlike join(iter.map(f), sep)
, this
function does not require the mapping closure to be Clone
.
If Clone
for the Iterator
is too expensive, consider using
join_map_once()
.
Examples
let value = fmty::join_map(["hola", "mundo"], " ", fmty::to_ascii_uppercase);
assert_eq!(value.to_string(), "HOLA MUNDO");