Open amab8901 opened 4 months ago
This might be done as part of #844. It might be named maybe_collect_vec
and could be called on Iterator<Item = Option<T>>
and on Iterator<Item = Result<T, E>>
(and not just the second).
maybe_
-prefixed to avoid any conflict with the stdlib which should own try_
-prefixed methods.
Our try_collect
is in conflict with nightly Rust.
would be great to also have try_join()
when the iterator has elements of type Result<String>
or Result<&str>
!
We probably won't add many maybe_
/try_
methods.
But there is .process_results(|it| it.join())
that should work for your use case.
Same as
try_collect()
except that I don't have to specify Vec<_> as a type parameter