-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Component groups and get_many
/get_many_mut
for EntityRef
/EntityMut
.
#11584
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
base: main
Are you sure you want to change the base?
Conversation
Added ComponentGroup that allow tuple of components to function similar to `Component` at the type level. Added data side support for `Or` and its counterpart `And`. Added `Is` that replaces the previous functionality of `Changed` and `Added` on the data side.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not seeing the clear benefit of having this when the QueryData
and QueryFilter
macros exist. They seem to do the same thing.
It is designed for generic type projection in traits, specifically for library authors, as shown in the example. The macros only work for specific components. What this trait means is 'Any number of components that act as a single component'. The analogues to Edit: Updated PR to show more intent. |
get_many
/get_many_mut
for EntityRef
/EntityMut
.
Edit: Added new major functionality of |
Triage: has merge conflicts |
This PR is designed with ideas before the QueryData/QueryFilter split. I'd imagine starting a new PR would be better. That being said categorizing it as |
Objective
Give a generic group of components similar functionality as if they were a single component. This is achieved with access to ergonomic filter queries and with
get
function support forEntityRef
/EntityMut
.Use case:
Solution
Added trait
ComponentGroup
implemented on components and tupleBundle
s. The trait has GATs that converts the tuple into queries,With
queries,Has
queries,Added
queries,Changed
queries, etc.Or
and its new counterpartAnd
can now be used on the data side as boolean combinators to support this change.Changelog
ComponentGroup
.And
andOr
to function on the data side.And
andOr
can be used with filter-only queries on the data side. This currently causes no issue but do keep this in mind.Changed
andAdded
recently got removed from the data side due to their confusing nature, definedIs<T> = And<(T,)>
as a way to use these queries on the data side.Always
andNever
as default cases for some queries.get_many
andget_many_mut
on component groups.Migration Guide
I don't think there is a breaking change here.