pub struct ComponentTicks {
pub added: Tick,
pub changed: Tick,
}Expand description
Records when a component or resource was added and when it was last mutably dereferenced (or added).
Fields§
§added: TickTick recording the time this component or resource was added.
changed: TickTick recording the time this component or resource was most recently changed.
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 new(change_tick: Tick) -> Self
pub fn new(change_tick: Tick) -> Self
Creates a new instance with the same change tick for added and changed.
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