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

Treating a parallel iterator as a serial iterator #850

Closed
zesterer opened this issue Apr 23, 2021 · 4 comments
Closed

Treating a parallel iterator as a serial iterator #850

zesterer opened this issue Apr 23, 2021 · 4 comments

Comments

@zesterer
Copy link
Contributor

I'm the a peculiar situation that requires me to take an impl ParallelIterator and treat it as a standard, serial iterator. Intuitively, it feels like it should be trivially safe to pull items out of a parallel iterator serially to get back an impl Iterator, but I don't see any API features in rayon that permit this.

Is this a) possible as I presume it is and b) something that's desirable?

@wagnerf42
Copy link
Contributor

could you tell us more about what you are doing ? that would help figuring out whether it is desirable or not. currently you cannot turn back to sequential.

@zesterer
Copy link
Contributor Author

zesterer commented Apr 26, 2021

The context isn't really important here. It's not a situation I'd like to be in, but it's one that would be useful to have rayon support, given that I'd imagine pulling out items serially would be relatively trivial to do. I have an API that produces an impl ParallelIterator, and I need to pass it to another API that consumes impl Iterator.

@cuviper
Copy link
Member

cuviper commented Apr 26, 2021

It's not trivial, or we would have solved #210 a long time ago. 😉

But there may be reasonable domain-specific options, depending on your needs.

@zesterer
Copy link
Contributor Author

Ah, an issue for the same thing! I'll close in favour of that, thanks for bringing it to my attention.

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

No branches or pull requests

3 participants