pub struct Res<'w, T: 'static> { /* 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. Carries change-detection
metadata — call is_changed to check.
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.
Implementations§
Source§impl<'w, T: 'static> Res<'w, T>
impl<'w, T: 'static> Res<'w, T>
Sourcepub fn is_changed(&self) -> bool
pub fn is_changed(&self) -> bool
Returns true if the resource was modified during the current sequence.
Sourcepub fn changed_after(&self, since: Sequence) -> bool
pub fn changed_after(&self, since: Sequence) -> bool
Returns true if the resource was modified after since.
Unlike is_changed (equality check against
current sequence), this uses > — suitable for checking whether
any event since a prior checkpoint wrote this resource.
Relies on numeric ordering of the underlying u64 counter.
Not wrap-safe, but at one increment per event the u64 sequence
space takes ~584 years at 1 GHz to exhaust.
Trait Implementations§
Source§impl<T: 'static> Param for Res<'_, T>
impl<T: 'static> Param for Res<'_, T>
Source§type State = ResourceId
type State = ResourceId
ResourceId). Read more