Add documentation to last_change_tick (#8598)
# Objective This method has no documentation and it's extremely unclear what it does, or what the returned tick represents. ## Solution Write documentation.
This commit is contained in:
parent
c399755c74
commit
b4e7f0899a
@ -1499,6 +1499,12 @@ impl World {
|
||||
Tick::new(tick)
|
||||
}
|
||||
|
||||
/// When called from within an exclusive system (a [`System`] that takes `&mut World` as its first
|
||||
/// parameter), this method returns the [`Tick`] indicating the last time the exclusive system was run.
|
||||
///
|
||||
/// Otherwise, this returns the `Tick` indicating the last time that [`World::clear_trackers`] was called.
|
||||
///
|
||||
/// [`System`]: crate::system::System
|
||||
#[inline]
|
||||
pub fn last_change_tick(&self) -> Tick {
|
||||
self.last_change_tick
|
||||
|
||||
@ -237,11 +237,20 @@ impl<'w> UnsafeWorldCell<'w> {
|
||||
unsafe { self.world_metadata() }.read_change_tick()
|
||||
}
|
||||
|
||||
/// Returns the [`Tick`] indicating the last time that [`World::clear_trackers`] was called.
|
||||
///
|
||||
/// If this `UnsafeWorldCell` was created from inside of an exclusive system (a [`System`] that
|
||||
/// takes `&mut World` as its first parameter), this will instead return the `Tick` indicating
|
||||
/// the last time the system was run.
|
||||
///
|
||||
/// See [`World::last_change_tick()`].
|
||||
///
|
||||
/// [`System`]: crate::system::System
|
||||
#[inline]
|
||||
pub fn last_change_tick(self) -> Tick {
|
||||
// SAFETY:
|
||||
// - we only access world metadata
|
||||
unsafe { self.world_metadata() }.last_change_tick
|
||||
unsafe { self.world_metadata() }.last_change_tick()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user