Skip to content

Commit

Permalink
Updated EntityRef::get_change_ticks_by_id branch with upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
sQu1rr committed Nov 24, 2022
1 parent 22d4652 commit 85e1088
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions crates/bevy_ecs/src/world/entity_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,13 @@ impl<'w> EntityRef<'w> {
/// use this in cases where the actual component types are not known at
/// compile time.**
#[inline]
pub fn get_change_ticks_by_id(&self, component_id: ComponentId) -> Option<&'w ComponentTicks> {
pub fn get_change_ticks_by_id(&self, component_id: ComponentId) -> Option<ComponentTicks> {
if !self.contains_id(component_id) {
return None;
}

// SAFETY: entity location is valid and component_id exists
unsafe {
get_ticks(self.world, component_id, self.entity, self.location)
.map(|ticks| ticks.deref())
}
unsafe { get_ticks(self.world, component_id, self.entity, self.location) }
}

/// Gets a mutable reference to the component of type `T` associated with
Expand Down Expand Up @@ -232,16 +229,13 @@ impl<'w> EntityMut<'w> {
/// use this in cases where the actual component types are not known at
/// compile time.**
#[inline]
pub fn get_change_ticks_by_id(&self, component_id: ComponentId) -> Option<&ComponentTicks> {
pub fn get_change_ticks_by_id(&self, component_id: ComponentId) -> Option<ComponentTicks> {
if !self.contains_id(component_id) {
return None;
}

// SAFETY: entity location is valid and component_id exists
unsafe {
get_ticks(self.world, component_id, self.entity, self.location)
.map(|ticks| ticks.deref())
}
unsafe { get_ticks(self.world, component_id, self.entity, self.location) }
}

/// Gets a mutable reference to the component of type `T` associated with
Expand Down

0 comments on commit 85e1088

Please sign in to comment.