Results and Iterator patterns
What?
Describe some useful patterns when iterating over Result types.
Why?
Working with an iterator of Results (i.e. Iterator<Item = Result<O, E>>) can be a bit of a hassle for beginner and intermediate Rust programmers.
When collecting the result of the iteration into a variable, the main question is, what shall be the resulting datatype?
- All
Oks? - All
Errors? - The first
Error? - The first
Ok? - Something else?
How?
Show some patterns from Iteration patterns for Result & Option. Show usage of a library for that, e.g. resiter
This is one I'd definitely love to see. As a rust beginner, idiomatic usage of iterators and result types is a stumbling block. Also, although it may be outside of the scope of this specific issue, when to use .iter() vs .iter_mut() vs .into_iter() is confusing, and it'd be cool to see examples of when each of these is recommended.