Add missing docs to World::change_tick and World::read_change_tick (#6765)
# Objective The methods `World::change_tick` and `World::read_change_tick` lack documentation and have confusingly similar behavior. ## Solution Add documentation and clarify the distinction between the two functions.
This commit is contained in:
parent
b337ed63ad
commit
83e8224694
@ -1396,11 +1396,19 @@ impl World {
|
|||||||
self.change_tick.fetch_add(1, Ordering::AcqRel)
|
self.change_tick.fetch_add(1, Ordering::AcqRel)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Reads the current change tick of this world.
|
||||||
|
///
|
||||||
|
/// If you have exclusive (`&mut`) access to the world, consider using [`change_tick()`](Self::change_tick),
|
||||||
|
/// which is more efficient since it does not require atomic synchronization.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn read_change_tick(&self) -> u32 {
|
pub fn read_change_tick(&self) -> u32 {
|
||||||
self.change_tick.load(Ordering::Acquire)
|
self.change_tick.load(Ordering::Acquire)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Reads the current change tick of this world.
|
||||||
|
///
|
||||||
|
/// This does the same thing as [`read_change_tick()`](Self::read_change_tick), only this method
|
||||||
|
/// is more efficient since it does not require atomic synchronization.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn change_tick(&mut self) -> u32 {
|
pub fn change_tick(&mut self) -> u32 {
|
||||||
*self.change_tick.get_mut()
|
*self.change_tick.get_mut()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user