From 8d23a5bea5b42f46ef7f337422844799fb5112a1 Mon Sep 17 00:00:00 2001 From: Stepan Koltsov Date: Sat, 30 Dec 2023 21:58:04 +0000 Subject: [PATCH] impl ExclusiveSystemParam for PhantomData --- crates/bevy_ecs/src/system/exclusive_system_param.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/crates/bevy_ecs/src/system/exclusive_system_param.rs b/crates/bevy_ecs/src/system/exclusive_system_param.rs index 2eb3c06941ed6..3ffa25523bf4d 100644 --- a/crates/bevy_ecs/src/system/exclusive_system_param.rs +++ b/crates/bevy_ecs/src/system/exclusive_system_param.rs @@ -6,6 +6,7 @@ use crate::{ }; use bevy_utils::all_tuples; use bevy_utils::synccell::SyncCell; +use std::marker::PhantomData; /// A parameter that can be used in an exclusive system (a system with an `&mut World` parameter). /// Any parameters implementing this trait must come after the `&mut World` parameter. @@ -70,6 +71,17 @@ impl<'_s, T: FromWorld + Send + 'static> ExclusiveSystemParam for Local<'_s, T> } } +impl ExclusiveSystemParam for PhantomData { + type State = (); + type Item<'s> = PhantomData; + + fn init(_world: &mut World, _system_meta: &mut SystemMeta) -> Self::State {} + + fn get_param<'s>(_state: &'s mut Self::State, _system_meta: &SystemMeta) -> Self::Item<'s> { + PhantomData + } +} + macro_rules! impl_exclusive_system_param_tuple { ($($param: ident),*) => { #[allow(unused_variables)]