Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: try_collect_vec() #934

Open
amab8901 opened this issue May 13, 2024 · 3 comments
Open

Feature request: try_collect_vec() #934

amab8901 opened this issue May 13, 2024 · 3 comments
Labels
fallible-iterator Iterator of results/options

Comments

@amab8901
Copy link

Same as try_collect() except that I don't have to specify Vec<_> as a type parameter

@Philippe-Cholet Philippe-Cholet added the fallible-iterator Iterator of results/options label May 13, 2024
@Philippe-Cholet
Copy link
Member

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.

@amab8901
Copy link
Author

amab8901 commented May 13, 2024

would be great to also have try_join() when the iterator has elements of type Result<String> or Result<&str>!

@Philippe-Cholet
Copy link
Member

We probably won't add many maybe_/try_ methods.

But there is .process_results(|it| it.join()) that should work for your use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fallible-iterator Iterator of results/options
Projects
None yet
Development

No branches or pull requests

2 participants