#017 Mar 20, 2022iterator map filter17. filter_mapSimilar to map but if allows to drop an item.1 2 3 4 5 6 7 8 let text_nums = ["1", "two", "three", "4"]; let nums: Vec<_> = text_nums .iter() .filter_map(|x| x.parse::<u32>().ok()) .collect(); assert_eq!(nums, vec![1, 4]); This post is licensed under CC BY 4.0 by the author.Share: ← Previous 11. Fuse Next → 13. Fold