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 QueryState::contains to mirror Query::contains #12750

Closed
ItsDoot opened this issue Mar 27, 2024 · 2 comments · Fixed by #12776
Closed

Add QueryState::contains to mirror Query::contains #12750

ItsDoot opened this issue Mar 27, 2024 · 2 comments · Fixed by #12776
Labels
A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use

Comments

@ItsDoot
Copy link
Contributor

ItsDoot commented Mar 27, 2024

What problem does this solve or what need does it fill?

There exists Query::contains, but not QueryState::contains.

What solution would you like?

Add QueryState::contains.

Additional context

Query::contains was originally added in #3090 in 2021; QueryState wasn't generally accessible by users until #6083 in 2022, so just seems like an oversight.

@ItsDoot ItsDoot added A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use labels Mar 27, 2024
@FlippinBerger
Copy link
Contributor

Wouldn't the implementation for QueryState::contains be essentially the same thing as Query::contains since the current Query impl accesses its QueryState as_nop and calls the QueryState method get_unchecked_manual?

I'm not 100% on what the use case of adding QueryState::contains would be, but I'd imagine the implementation of Query::contains would just call the newly added impl that this issue is requesting. Not necessarily a problem, I'm just trying to understand what situations moving this logic down to QueryState would solve.

@ItsDoot
Copy link
Contributor Author

ItsDoot commented Mar 28, 2024

Wouldn't the implementation for QueryState::contains be essentially the same thing as Query::contains since the current Query impl accesses its QueryState as_nop and calls the QueryState method get_unchecked_manual?

Correct; this would simply be to give QueryState all the exact same tools as Query.

github-merge-queue bot pushed a commit that referenced this issue Mar 29, 2024
…ate) (#12776)

# Objective
Fixes #12752. Fixes #12750. Document the runtime complexity of all of
the `O(1)` operations on the individual APIs.

## Solution

  * Mirror `Query::contains` onto `QueryState::contains`
  * Make `QueryState::as_nop` pub(crate)
  * Make `NopWorldQuery` pub(crate)
  * Document all of the O(1) operations on Query and QueryState.
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants