pub struct ResMut<'w, T: 'static> { /* private fields */ }Expand description
Mutable reference to a resource in World.
Analogous to Bevy’s ResMut<T>.
Appears in handler function signatures to declare a write dependency.
Derefs to the inner value transparently. Stamps the resource’s
changed_at sequence on DerefMut — the act of writing is the
change signal.
For shared read access, use Res<T>. For optional write access
(no panic if unregistered), use Option<ResMut<T>>.
Construction is pub(crate) — only the dispatch layer creates these.
Implementations§
Source§impl<'w, T: 'static> ResMut<'w, T>
impl<'w, T: 'static> ResMut<'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 ResMut<'_, T>
impl<T: 'static> Param for ResMut<'_, T>
Source§type State = ResourceId
type State = ResourceId
ResourceId). Read more