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

Consuming a ParallelIterator with a for loop #645

Closed
kpcyrd opened this issue Mar 17, 2019 · 4 comments
Closed

Consuming a ParallelIterator with a for loop #645

kpcyrd opened this issue Mar 17, 2019 · 4 comments

Comments

@kpcyrd
Copy link

kpcyrd commented Mar 17, 2019

It seems all rayon examples use something functional like .sum() or for_each with a function that can be executed in parallel.

Sometimes I want to run a .map() in parallel for each item but consume the results sequentially with a for loop. Is there a way to do that?

I'm currently back to rolling my own with the threadpool crate.

@cuviper
Copy link
Member

cuviper commented Mar 19, 2019

We don't have this in rayon yet -- #210.

In the meantime, you might like the par-map crate as an alternative.

@nikomatsakis
Copy link
Member

Closing as a duplicate of #210 --thanks @kpcyrd !

@safinaskar
Copy link

Here is my solution: #1071

@safinaskar
Copy link

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

4 participants