I have a vector of Option
s and I want to filter only the Some
s. I use filter_map
with identity:
let v = vec![Some(1), None, Some(2)];
for i in v.into_iter().filter_map(|o| o) {
println!("{}", i);
}
Is there a builtin function permitting to write something like filter_map(identity)
?