-
Notifications
You must be signed in to change notification settings - Fork 501
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
Trait generic over core::iter::Iterator
and rayon::iter::ParallelIterator
#606
Comments
Converting to an A generic trait covering both |
How would a type parameter help your use case? You would still be forced to "leak" that information by writing |
I was reminded today of a little experiment I did: I haven't published it, but I'm considering. This adds a new wrapper type which has its own API that is a common subset of fn foo(...) -> CondIterator<impl ParallelIterator<Item = T>, impl Iterator<Item = T>> Thus returning a type that is iterator-like, without committing to being parallel or serial. Internally, you could use an |
I just found myself needing this again today, this time so I can work around the issue of how Would be great to see it published or added to rayon! |
I finally got around to publishing I think that's about as close as we can get, since the APIs are subtly different, so I'm going to close this issue. If anyone has new ideas, feel free to re-open or start a new issue. |
I want to return a type that’s
core::iter::Iterator
from a function, usingimpl Iterator
syntax. Since Rayon has adopted a different trait,rayon::iter::ParallelIterator
, my only option seems to leak implementation details and returnimpl ParallelIterator
.What can be done about this?
The text was updated successfully, but these errors were encountered: