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

FromIterator<F> for Unicycle<F> would be more ergonomic #2

Closed
dekellum opened this issue Jan 30, 2020 · 4 comments
Closed

FromIterator<F> for Unicycle<F> would be more ergonomic #2

dekellum opened this issue Jan 30, 2020 · 4 comments
Labels
enhancement New feature or request

Comments

@dekellum
Copy link

I tested one case, and I suspect it will be a common pattern for users to want to drop in Unicycle where FuturesUnordered was previously used. The Unicyle would have been a drop in replacement if it implemented FromIterator like FuturesUnordered does, allowing it to be assembled via std::iter::Iterator::collect.

@udoprog
Copy link
Owner

udoprog commented Jan 31, 2020

Thanks for the report!
I've added naive implementations for Collect in master at the moment.

They could be improved to take [Iterator::size_hint] into account to pre-allocate the collections used, so I've opened #3 to track this.

@BlinkyStitt
Copy link

Can you share an example of using this? Thanks!

@udoprog
Copy link
Owner

udoprog commented Mar 18, 2020

Hey @wysenynja

I added an example here: https://github.com/udoprog/unicycle/blob/master/src/lib.rs#L54

Does that help?

@BlinkyStitt
Copy link

BlinkyStitt commented Mar 18, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants