Skip to content

Commit

Permalink
Update increment_change_tick to return a strongly-typed Tick (#8295)
Browse files Browse the repository at this point in the history
# Objective

While migrating the engine to use the `Tick` type in #7905, I forgot to
update `UnsafeWorldCell::increment_change_tick`.

## Solution

Update the function.

---

## Changelog

- The function `UnsafeWorldCell::increment_change_tick` is now
strongly-typed, returning a value of type `Tick` instead of a raw `u32`.

## Migration Guide

The function `UnsafeWorldCell::increment_change_tick` is now
strongly-typed, returning a value of type `Tick` instead of a raw `u32`.
  • Loading branch information
JoJoJet authored Apr 3, 2023
1 parent 09f1bd0 commit 086db6d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions crates/bevy_ecs/src/world/unsafe_world_cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,10 @@ impl<'w> UnsafeWorldCell<'w> {
}

#[inline]
pub fn increment_change_tick(self) -> u32 {
pub fn increment_change_tick(self) -> Tick {
// SAFETY:
// - we only access world metadata
unsafe { self.world_metadata() }
.change_tick
.fetch_add(1, Ordering::AcqRel)
unsafe { self.world_metadata() }.increment_change_tick()
}

/// Shorthand helper function for getting the [`ArchetypeComponentId`] for a resource.
Expand Down

0 comments on commit 086db6d

Please sign in to comment.