4 ms·
It sounds like the author is not aware of the `FromIterator` trait which is implemented for `Result` which allows short circuiting to a `Result` type. Instead
by nu11ptr 4y ago
It sounds like the author is not aware of the `FromIterator` trait which is implemented for `Result` which allows short circuiting to a `Result` type.
Instead of collecting to:
Vec<Result<T,Error>>
You collect to:
Result<Vec<T>,Error>
as your explicit type and your iterator will short circuit on the first error. I admit this was not obvious to me either and should be talked about more as it is very handy.