Document panic condition
This commit is contained in:
parent
c424288b7f
commit
c8b1dccfe6
@ -1550,6 +1550,11 @@ impl<'w> EntityWorldMut<'w> {
|
||||
/// Temporarily removes the requested resource from the [`World`], runs custom user code,
|
||||
/// then re-adds the resource before returning.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if the resource does not exist.
|
||||
/// Use [`try_resource_scope`](Self::try_resource_scope) instead if you want to handle this case.
|
||||
///
|
||||
/// See [`World::resource_scope`] for further details.
|
||||
#[track_caller]
|
||||
pub fn resource_scope<R: Resource, U>(
|
||||
|
@ -2551,6 +2551,11 @@ impl World {
|
||||
/// This enables safe simultaneous mutable access to both a resource and the rest of the [`World`].
|
||||
/// For more complex access patterns, consider using [`SystemState`](crate::system::SystemState).
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if the resource does not exist.
|
||||
/// Use [`try_resource_scope`](Self::try_resource_scope) instead if you want to handle this case.
|
||||
///
|
||||
/// # Example
|
||||
/// ```
|
||||
/// use bevy_ecs::prelude::*;
|
||||
@ -2568,8 +2573,6 @@ impl World {
|
||||
/// });
|
||||
/// assert_eq!(world.get_resource::<A>().unwrap().0, 2);
|
||||
/// ```
|
||||
///
|
||||
/// See also [`try_resource_scope`](Self::try_resource_scope).
|
||||
#[track_caller]
|
||||
pub fn resource_scope<R: Resource, U>(&mut self, f: impl FnOnce(&mut World, Mut<R>) -> U) -> U {
|
||||
self.try_resource_scope(f)
|
||||
|
Loading…
Reference in New Issue
Block a user