You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge pull request #58 from RobWalt/feat/without-one
solves #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);
});
}
```
// TODO: fix this https://github.com/bevyengine/bevy/issues/13798
835
+
panic!("transmuting and any other operations concerning the state of a query are currently broken and shouldn't be used. See https://github.com/JoJoJet/bevy-trait-query/issues/59");
0 commit comments