From ea887d8ffa4ba4ddd3a6b93818a1c150d837c14c Mon Sep 17 00:00:00 2001 From: Nicola Papale Date: Mon, 12 Jun 2023 19:52:11 +0200 Subject: [PATCH] Allow unsized types as mapped value in `Ref::map` (#8817) # Objective - I can't map unsized type using `Ref::map` (for example `dyn Reflect`) ## Solution - Allow unsized types (this is possible because `Ref` stores a reference to `T`) --- crates/bevy_ecs/src/change_detection.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_ecs/src/change_detection.rs b/crates/bevy_ecs/src/change_detection.rs index b66a098c30f42..38ccbef7b50bb 100644 --- a/crates/bevy_ecs/src/change_detection.rs +++ b/crates/bevy_ecs/src/change_detection.rs @@ -551,7 +551,7 @@ impl<'a, T: ?Sized> Ref<'a, T> { /// /// This doesn't do anything else than call `f` on the wrapped value. /// This is equivalent to [`Mut::map_unchanged`]. - pub fn map(self, f: impl FnOnce(&T) -> &U) -> Ref<'a, U> { + pub fn map(self, f: impl FnOnce(&T) -> &U) -> Ref<'a, U> { Ref { value: f(self.value), ticks: self.ticks,