In the Rust By Example book show us a way to handle errors in the map method of Iterator:
let strings = vec!["93", "tofu", "18"]; let numbers: Result<Vec<_>, _> = strings.into_iter().map(|s| s.parse::<i32>()).collect(); println!("Results: {:?}", numbers); Is it a similar way to deal with errors in Option like the following?
let a: Option<&str> = Some("tofu"); let b: Result<Option<i32>, _> = a.map(|a| a.parse::<i32>()); println!("Results: {:?}", b);