From 82eac065705d208c53e3b598fa6778b4f836968c Mon Sep 17 00:00:00 2001 From: PROMETHIA Date: Fri, 29 Jul 2022 08:27:39 -0400 Subject: [PATCH] Add `FromWorld` bound to `T` in `Local` --- crates/bevy_ecs/src/system/system_param.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/bevy_ecs/src/system/system_param.rs b/crates/bevy_ecs/src/system/system_param.rs index c3a419f0a8e20..0472e45c367c6 100644 --- a/crates/bevy_ecs/src/system/system_param.rs +++ b/crates/bevy_ecs/src/system/system_param.rs @@ -640,12 +640,12 @@ impl<'w, 's> SystemParamFetch<'w, 's> for WorldState { /// // .add_system(reset_to_system(my_config)) /// # assert_is_system(reset_to_system(Config(10))); /// ``` -pub struct Local<'a, T: Resource>(&'a mut T); +pub struct Local<'a, T: Resource + FromWorld>(&'a mut T); // SAFETY: Local only accesses internal state unsafe impl ReadOnlySystemParamFetch for LocalState {} -impl<'a, T: Resource> Debug for Local<'a, T> +impl<'a, T: Resource + FromWorld> Debug for Local<'a, T> where T: Debug, { @@ -654,7 +654,7 @@ where } } -impl<'a, T: Resource> Deref for Local<'a, T> { +impl<'a, T: Resource + FromWorld> Deref for Local<'a, T> { type Target = T; #[inline] @@ -663,7 +663,7 @@ impl<'a, T: Resource> Deref for Local<'a, T> { } } -impl<'a, T: Resource> DerefMut for Local<'a, T> { +impl<'a, T: Resource + FromWorld> DerefMut for Local<'a, T> { #[inline] fn deref_mut(&mut self) -> &mut Self::Target { self.0