Add query filter generic to `Res` and `ResMut`
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
## What problem does this solve or what need does it fill?
Now that resources are components we can use a lot of the features of queries with them. Unfortunately the only way you can use them is by avoiding `Res` and `ResMut` which makes it difficult for new users to find.
```rust
fn change_level_single(level: Single<&Level, Changed>) {
match level.0 {
...
}
}
// Note: This requires knowledge of `Populated`. Using `Query` will work, but doesn't skip if parameter cannot be found, which could make certain things harder.
fn change_level_query(level: Res, changed: Populated<() Changed>) {
match level.0 {
...
}
}
```
## What solution would you like?
Add query filters to `Res` and `ResMut`
```rust
fn change_level(level: Res>) {
match level.0 {
...
}
}
```
## What alternative(s) have you considered?
Continue to work with what we have, and improve `Res`/`ResMut` docs.
Contributor guide
Assessment
This issue has not been assessed yet.