What's the most idiomatic way of working with an Iterator of Results? [duplicate]
问题 This question already has answers here : How do I stop iteration and return an error when Iterator::map returns a Result::Err? (2 answers) Closed 7 months ago . I have code like this: let things = vec![/* ...*/]; // e.g. Vec<String> things .map(|thing| { let a = try!(do_stuff(thing)); Ok(other_stuff(a)) }) .filter(|thing_result| match *thing_result { Err(e) => true, Ok(a) => check(a), }) .map(|thing_result| { let a = try!(thing_result); // do stuff b }) .collect::<Result<Vec<_>, _>>() In