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

Add iter_many_manual QueryState method #8772

Merged
merged 1 commit into from
Jun 10, 2023

Conversation

nicopap
Copy link
Contributor

@nicopap nicopap commented Jun 7, 2023

Objective

QueryState exposes a get_manual and iter_manual method. However, there is now iter_many_manual.

iter_many_manual is useful when you have a &World (eg: the world in a Scene) and want to run a query several times on it (eg: iteratively navigate a hierarchy by calling iter_many on Children component).

iter_many's need for a &mut World makes the API much less flexible. The exclusive access pattern requires doing some very funky dance and excludes a category of algorithms for hierarchy traversal.

Solution

  • Add a iter_many_manual method to QueryState

Alternative

My current workaround is to use get_manual. However, this doesn't benefit from the optimizations on QueryManyIter.


Changelog

  • Add a iter_many_manual method to QueryState

@alice-i-cecile alice-i-cecile added A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use labels Jun 7, 2023
@alice-i-cecile alice-i-cecile requested a review from james7132 June 7, 2023 16:08
Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs and type signature appear to be correct, they match their neighbors, and safety invariants are obeyed.

This method should exist.

@alice-i-cecile alice-i-cecile requested a review from JoJoJet June 7, 2023 16:09
@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Jun 8, 2023
@alice-i-cecile alice-i-cecile enabled auto-merge June 8, 2023 00:05
@alice-i-cecile alice-i-cecile disabled auto-merge June 9, 2023 16:06
@alice-i-cecile alice-i-cecile enabled auto-merge June 9, 2023 16:06
@alice-i-cecile alice-i-cecile disabled auto-merge June 9, 2023 16:06
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Jun 10, 2023
Merged via the queue into bevyengine:main with commit 527d3a5 Jun 10, 2023
@nicopap nicopap deleted the query_get_unchecked_manual branch August 30, 2023 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants