Skip to content
11 changes: 11 additions & 0 deletions crates/bevy_ecs/src/change_detection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,17 @@ impl<'a> MutUntyped<'a> {
pub fn as_ref(&self) -> Ptr<'_> {
self.value.as_ref()
}

/// Transforms this [`MutUntyped`] into a [`Mut<T>`] with the same lifetime.
///
/// # Safety
/// - `T` must be the erased pointee type for this [`MutUntyped`].
pub unsafe fn with_type<T>(self) -> Mut<'a, T> {
Mut {
value: self.value.deref_mut(),
ticks: self.ticks,
}
}
}

impl<'a> DetectChanges for MutUntyped<'a> {
Expand Down