bevy/crates/bevy_ecs/src
poopy 4aed2ca74c
Add World::try_resource_scope (#16707)
# Objective

Fixes #16706

## Solution 

- Added new method: `try_resource_scope` which returns `None` if the
requested resource doesn't exist.
- Changed the `resource_scope` test to use `try_resource_scope` as well
to test for the `None` case.

---

## Showcase

```rust
world.try_resource_scope::<MyResource, _>(|world, mut my_resource| {
    // do something with the resource if it exists
});
```
2024-12-08 15:40:09 +00:00
..
entity Flush commands after every mutation in WorldEntityMut (#16219) 2024-12-05 20:30:12 +00:00
event Window picking (#16103) 2024-12-05 21:14:39 +00:00
identifier Use en-us locale for typos (#16037) 2024-10-20 18:55:17 +00:00
observer Window picking (#16103) 2024-12-05 21:14:39 +00:00
query Deny derive_more error feature and replace it with thiserror (#16684) 2024-12-06 17:03:55 +00:00
reflect Add Immutable Component Support (#16372) 2024-12-05 14:27:48 +00:00
schedule ✏️ Fix typos across bevy (#16702) 2024-12-08 01:18:39 +00:00
storage ✏️ Fix typos across bevy (#16702) 2024-12-08 01:18:39 +00:00
system Deny derive_more error feature and replace it with thiserror (#16684) 2024-12-06 17:03:55 +00:00
world Add World::try_resource_scope (#16707) 2024-12-08 15:40:09 +00:00
archetype.rs Add Trigger::components, which lists the component targets that were triggered (#15811) 2024-10-15 02:17:03 +00:00
batching.rs Fix *most* clippy lints (#15906) 2024-10-14 20:52:35 +00:00
bundle.rs Run observers before hooks for on_replace and on_remove (#16499) 2024-12-06 00:24:27 +00:00
change_detection.rs Migrate from Query::single and friends to Single (#15872) 2024-10-13 20:32:06 +00:00
component.rs Deny derive_more error feature and replace it with thiserror (#16684) 2024-12-06 17:03:55 +00:00
intern.rs Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
label.rs Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
lib.rs Add World::try_resource_scope (#16707) 2024-12-08 15:40:09 +00:00
removal_detection.rs fix: add reflect to SceneInstanceReady and other observers/events (#16018) 2024-10-20 13:51:41 +00:00
result.rs Fallible systems (#16589) 2024-12-05 22:29:06 +00:00
traversal.rs Window picking (#16103) 2024-12-05 21:14:39 +00:00