pub struct ComponentTicks { /* private fields */ }
Expand description
Records when a component or resource was added and when it was last mutably dereferenced (or added).
Implementations§
Source§impl ComponentTicks
impl ComponentTicks
Sourcepub fn is_added(&self, last_run: Tick, this_run: Tick) -> bool
pub fn is_added(&self, last_run: Tick, this_run: Tick) -> bool
Returns true
if the component or resource was added after the system last ran
(or the system is running for the first time).
Sourcepub fn is_changed(&self, last_run: Tick, this_run: Tick) -> bool
pub fn is_changed(&self, last_run: Tick, this_run: Tick) -> bool
Returns true
if the component or resource was added or mutably dereferenced after the system last ran
(or the system is running for the first time).
Sourcepub fn last_changed_tick(&self) -> Tick
pub fn last_changed_tick(&self) -> Tick
Returns the tick recording the time this component or resource was most recently changed.
Sourcepub fn added_tick(&self) -> Tick
pub fn added_tick(&self) -> Tick
Returns the tick recording the time this component or resource was added.
Sourcepub fn set_changed(&mut self, change_tick: Tick)
pub fn set_changed(&mut self, change_tick: Tick)
Manually sets the change tick.
This is normally done automatically via the DerefMut
implementation
on Mut<T>
, ResMut<T>
, etc.
However, components and resources that make use of interior mutability might require manual updates.
§Example
let world: World = unimplemented!();
let component_ticks: ComponentTicks = unimplemented!();
component_ticks.set_changed(world.read_change_tick());
Trait Implementations§
Source§impl Clone for ComponentTicks
impl Clone for ComponentTicks
Source§fn clone(&self) -> ComponentTicks
fn clone(&self) -> ComponentTicks
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more