Closed
Description
What problem does this solve or what need does it fill?
I commonly find myself reaching for Option<&C>
when I just need to check whether or not a component exists, and then branching on Some
versus None
.
This works well enough, but:
- The access is more restrictive than it needs to be: we request read access, but only actually need existence checking. This limits parallelism, as these systems could run in parallel with mutating systems.
- It's less clear to read: the pattern is a bit strange and implicit.
- It may be measurably slower.
What solution would you like?
Add a Has<C: Component>
type. Implement WorldQuery
for this, with no access required.
The item type of each query element should be bool
.
What alternative(s) have you considered?
We could do nothing, the eixisting pattern isn't terrible.
We could name this Is<C>
: I'm not sure which one is clearer.