What’s the most idiomatic way of working with an Iterator of Results? [duplicate]
There are lots of ways you could mean this. If you just want to panic, use .map(|x| x.unwrap()). If you want all results or a single error, collect into a Result<X<T>>: let results: Result<Vec<i32>, _> = result_i32_iter.collect(); If you want everything except the errors, use .filter_map(|x| x.ok()) or .flat_map(|x| x). If you want everything up … Read more