pub struct Res<'w, T: Resource> { /* private fields */ }Expand description
Shared reference to a resource in World.
Analogous to Bevy’s Res<T>.
Appears in handler function signatures to declare a read dependency. Derefs to the inner value transparently.
For exclusive write access, use ResMut<T>. For optional read
access (no panic if unregistered), use Option<Res<T>>.
Construction is pub(crate) — only the dispatch layer creates these.
Trait Implementations§
Source§impl<T: Resource> Param for Res<'_, T>
impl<T: Resource> Param for Res<'_, T>
Source§type State = ResourceId
type State = ResourceId
Opaque state cached at build time (e.g.
ResourceId). Read moreSource§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 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