Commit 4aed2ca
authored
Add
# Objective
Fixes bevyengine#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
});
```World::try_resource_scope (bevyengine#16707)1 parent 0707c07 commit 4aed2ca
2 files changed
+30
-25
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1484 | 1484 | | |
1485 | 1485 | | |
1486 | 1486 | | |
| 1487 | + | |
1487 | 1488 | | |
1488 | 1489 | | |
1489 | 1490 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2874 | 2874 | | |
2875 | 2875 | | |
2876 | 2876 | | |
| 2877 | + | |
| 2878 | + | |
2877 | 2879 | | |
2878 | 2880 | | |
| 2881 | + | |
| 2882 | + | |
| 2883 | + | |
| 2884 | + | |
| 2885 | + | |
| 2886 | + | |
| 2887 | + | |
| 2888 | + | |
| 2889 | + | |
| 2890 | + | |
| 2891 | + | |
| 2892 | + | |
| 2893 | + | |
| 2894 | + | |
| 2895 | + | |
2879 | 2896 | | |
2880 | 2897 | | |
2881 | 2898 | | |
2882 | | - | |
2883 | | - | |
2884 | | - | |
2885 | | - | |
| 2899 | + | |
2886 | 2900 | | |
2887 | 2901 | | |
2888 | 2902 | | |
2889 | 2903 | | |
2890 | | - | |
2891 | | - | |
| 2904 | + | |
2892 | 2905 | | |
2893 | 2906 | | |
2894 | 2907 | | |
| |||
2912 | 2925 | | |
2913 | 2926 | | |
2914 | 2927 | | |
2915 | | - | |
2916 | | - | |
2917 | | - | |
2918 | | - | |
2919 | | - | |
2920 | | - | |
2921 | | - | |
2922 | | - | |
2923 | | - | |
2924 | | - | |
2925 | | - | |
2926 | | - | |
2927 | | - | |
2928 | | - | |
2929 | | - | |
2930 | | - | |
2931 | | - | |
| 2928 | + | |
| 2929 | + | |
| 2930 | + | |
| 2931 | + | |
| 2932 | + | |
| 2933 | + | |
| 2934 | + | |
| 2935 | + | |
2932 | 2936 | | |
2933 | | - | |
| 2937 | + | |
2934 | 2938 | | |
2935 | | - | |
| 2939 | + | |
2936 | 2940 | | |
2937 | 2941 | | |
2938 | 2942 | | |
| |||
0 commit comments