forked from JoJoJet/bevy-trait-query
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request JoJoJet#58 from RobWalt/feat/without-one
solves JoJoJet#50 feat: Implement `WithoutAny` filter This PR: 1. implements `WithoutAny`, a `QueryFilter` which is supposed to be the opposite of `WithOne` 2. cleans up some parts of `WithOne` to make it `QueryFilter` only Note that 2. is a breaking change since we can't use it in the Data position anymore. However, I think this is fine since there is `One` which already fills this gap. So this is really a fix since it clears up the separation of concerns of the two structs. --- Small pseudo code example: ```rust struct Food; trait Fruit {} struct Banana; impl Fruit for Banana {} struct Apple; impl Fruit for Apple {} struct Sweets; struct Cake; fn eat_unhealthy( mut commands: Commands, q_non_fruits: Query<Entity, (With<Food>, WithoutAny<&dyn Fruit>)> ) { q_non_fruits.iter().for_each(|food| { // only sweets and cakes without fruits commands.eat(food); }); } ```
- Loading branch information
Showing
2 changed files
with
132 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters