bevy/crates/bevy_ecs/src
Mark Wainwright 6529d2e7f0
Added Has<T> WorldQuery type (#8844)
# Objective

- Fixes #7811 

## Solution

- I added `Has<T>` (and `HasFetch<T>` ) and implemented `WorldQuery`,
`ReadonlyWorldQuery`, and `ArchetypeFilter` it
- I also added documentation with an example and a unit test


I believe I've done everything right but this is my first contribution
and I'm not an ECS expert so someone who is should probably check my
implementation. I based it on what `Or<With<T>,>`, would do. The only
difference is that `Has` does not update component access - adding `Has`
to a query should never affect whether or not it is disjoint with
another query *I think*.

---

## Changelog

## Added
- Added `Has<T>` WorldQuery to find out whether or not an entity has a
particular component.

---------

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Co-authored-by: JoJoJet <21144246+JoJoJet@users.noreply.github.com>
2023-06-19 13:56:20 +00:00
..
entity Document every public item in bevy_ecs (#8731) 2023-06-10 23:23:48 +00:00
query Added Has<T> WorldQuery type (#8844) 2023-06-19 13:56:20 +00:00
reflect Split the bevy_ecs reflect.rs module (#8834) 2023-06-18 23:43:10 +00:00
schedule Document every public item in bevy_ecs (#8731) 2023-06-10 23:23:48 +00:00
storage Document every public item in bevy_ecs (#8731) 2023-06-10 23:23:48 +00:00
system doc: update a reference from add_system to add_systems (#8881) 2023-06-18 17:17:02 +00:00
world Migrate the rest of the engine to UnsafeWorldCell (#8833) 2023-06-15 01:31:56 +00:00
archetype.rs Document every public item in bevy_ecs (#8731) 2023-06-10 23:23:48 +00:00
bundle.rs Document every public item in bevy_ecs (#8731) 2023-06-10 23:23:48 +00:00
change_detection.rs Allow unsized types as mapped value in Ref::map (#8817) 2023-06-12 17:52:11 +00:00
component.rs Simplify the ComponentIdFor type (#8845) 2023-06-15 12:57:47 +00:00
event.rs Document every public item in bevy_ecs (#8731) 2023-06-10 23:23:48 +00:00
lib.rs Add a method to run read-only systems using &World (#8849) 2023-06-15 22:54:53 +00:00
removal_detection.rs Simplify the ComponentIdFor type (#8845) 2023-06-15 12:57:47 +00:00