pub struct Res<'w, T: 'static> { /* private fields */ }Expand description
Shared reference to a resource in World.
Appears in system function signatures to declare a read dependency.
Derefs to the inner value transparently. Carries change-detection
metadata — call is_changed to check.
Construction is pub(crate) — only the dispatch layer creates these.
Implementations§
Trait Implementations§
Source§impl<T: 'static> SystemParam for Res<'_, T>
impl<T: 'static> SystemParam for Res<'_, T>
Source§type State = ResourceId
type State = ResourceId
Opaque state cached at build time (e.g.
ResourceId).Source§fn init(registry: &Registry) -> ResourceId
fn init(registry: &Registry) -> ResourceId
Resolve state from the registry. Called once at build time. Read more
Source§unsafe fn fetch<'w>(world: &'w World, state: &'w mut ResourceId) -> Res<'w, T>
unsafe fn fetch<'w>(world: &'w World, state: &'w mut ResourceId) -> Res<'w, T>
Fetch the item using cached state. Read more
Source§fn any_changed(state: &ResourceId, world: &World) -> bool
fn any_changed(state: &ResourceId, world: &World) -> bool
Returns
true if any resource this param depends on was modified
during the current sequence. Read moreSource§fn resource_id(state: &ResourceId) -> Option<ResourceId>
fn resource_id(state: &ResourceId) -> Option<ResourceId>
The ResourceId this param accesses, if any. Read more
Auto Trait Implementations§
impl<'w, T> Freeze for Res<'w, T>
impl<'w, T> RefUnwindSafe for Res<'w, T>where
T: RefUnwindSafe,
impl<'w, T> Send for Res<'w, T>where
T: Sync,
impl<'w, T> Sync for Res<'w, T>where
T: Sync,
impl<'w, T> Unpin for Res<'w, T>
impl<'w, T> UnsafeUnpin for Res<'w, T>
impl<'w, T> UnwindSafe for Res<'w, T>where
T: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more