-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Simplify parallel iteration methods #8854
Conversation
Marking this as complex since there is a decent chance that I've missed some unsoundness. |
Couldn't it just consume |
Yes, that is another option. |
I'm much more comfortable having take ownership of Note: you may also need to change the other builder methods like |
Thinking more about it, this doesn't prevent |
I've modified |
@JoJoJet could you fix the conflict and the comment above? |
I've addressed James' comment and fixed the merge conflict. |
Objective
The
QueryParIter::for_each_mut
function is required when doing parallel iteration with mutable queries.This results in an unfortunate stutter:
query.par_iter_mut().par_for_each_mut()
('mut' is repeated).Solution
for_each
compatible with mutable queries, and deprecatefor_each_mut
. In order to preventfor_each
from being called multiple times in parallel, we take ownership of the QueryParIter.Changelog
QueryParIter::for_each
is now compatible with mutable queries.for_each_mut
has been deprecated as it is now redundant.Migration Guide
The method
QueryParIter::for_each_mut
has been deprecated and is no longer functional. Usefor_each
instead, which now supports mutable queries.The method
QueryParIter::for_each
now takes ownership of theQueryParIter
, rather than taking a shared reference.