Skip to main content

flat_map

Function flat_map 

Source
pub fn flat_map<T, R, F>(vec: Vec<T>, f: F) -> Vec<R>
where F: FnMut(T) -> Vec<R>,
Expand description

Map and flatten in one step

ยงExample

let words = vec!["hello", "world"]
let chars = flat_map(words, |s| s.chars().collect())