Skip to content

Commit ceb2fd7

Browse files
rename to_typed to map_unchanged
1 parent 181b463 commit ceb2fd7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

crates/bevy_ecs/src/change_detection.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ impl<'a> MutUntyped<'a> {
451451
/// # use bevy_ecs::change_detection::{Mut, MutUntyped};
452452
/// # let mut_untyped: MutUntyped = unimplemented!();
453453
/// // SAFETY: ptr is of type `u8`
454-
/// mut_untyped.to_typed(|ptr| unsafe { ptr.deref_mut::<u8>() });
454+
/// mut_untyped.map_unchanged(|ptr| unsafe { ptr.deref_mut::<u8>() });
455455
/// ```
456456
/// If you have a [`ReflectFromPtr`](bevy_reflect::ReflectFromPtr) that you know belongs to this [`MutUntyped`],
457457
/// you can do
@@ -460,9 +460,9 @@ impl<'a> MutUntyped<'a> {
460460
/// # let mut_untyped: MutUntyped = unimplemented!();
461461
/// # let reflect_from_ptr: bevy_reflect::ReflectFromPtr = unimplemented!();
462462
/// // SAFETY: from the context it is known that `ReflectFromPtr` was made for the type of the `MutUntyped`
463-
/// mut_untyped.to_typed(|ptr| unsafe { reflect_from_ptr.as_reflect_ptr_mut(ptr) });
463+
/// mut_untyped.map_unchanged(|ptr| unsafe { reflect_from_ptr.as_reflect_ptr_mut(ptr) });
464464
/// ```
465-
pub fn to_typed<T: ?Sized>(self, f: impl FnOnce(PtrMut<'a>) -> &'a mut T) -> Mut<'a, T> {
465+
pub fn map_unchanged<T: ?Sized>(self, f: impl FnOnce(PtrMut<'a>) -> &'a mut T) -> Mut<'a, T> {
466466
Mut {
467467
value: f(self.value),
468468
ticks: self.ticks,
@@ -779,7 +779,7 @@ mod tests {
779779

780780
let reflect_from_ptr = <ReflectFromPtr as FromType<i32>>::from_type();
781781

782-
let mut new = value.to_typed(|ptr| {
782+
let mut new = value.map_unchanged(|ptr| {
783783
// SAFETY: ptr has type of ReflectFromPtr
784784
let value = unsafe { reflect_from_ptr.as_reflect_ptr_mut(ptr) };
785785
value

0 commit comments

Comments
 (0)