-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify parallel iteration methods (#8854)
# 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 - Make `for_each` compatible with mutable queries, and deprecate `for_each_mut`. In order to prevent `for_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. Use `for_each` instead, which now supports mutable queries. ```rust // Before: query.par_iter_mut().for_each_mut(|x| ...); // After: query.par_iter_mut().for_each(|x| ...); ``` The method `QueryParIter::for_each` now takes ownership of the `QueryParIter`, rather than taking a shared reference. ```rust // Before: let par_iter = my_query.par_iter().batching_strategy(my_batching_strategy); par_iter.for_each(|x| { // ...Do stuff with x... par_iter.for_each(|y| { // ...Do nested stuff with y... }); }); // After: my_query.par_iter().batching_strategy(my_batching_strategy).for_each(|x| { // ...Do stuff with x... my_query.par_iter().batching_strategy(my_batching_strategy).for_each(|y| { // ...Do nested stuff with y... }); }); ```
- Loading branch information
Showing
7 changed files
with
57 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters