Function fmty::concat_map

source ·
pub fn concat_map<I, R, F>(iter: I, f: F) -> ConcatMap<I::IntoIter, F>where
    I: IntoIterator,
    I::IntoIter: Clone,
    F: Fn(I::Item) -> R,
Expand description

Concatenates mapped Iterator results.

Unlike concat(iter.map(f)), this function does not require the mapping closure to be Clone.

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

Examples

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