Skip to content

Commit

Permalink
impl ExclusiveSystemParam for PhantomData
Browse files Browse the repository at this point in the history
  • Loading branch information
stepancheg committed Dec 30, 2023
1 parent 786abbf commit 8d23a5b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions crates/bevy_ecs/src/system/exclusive_system_param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -70,6 +71,17 @@ impl<'_s, T: FromWorld + Send + 'static> ExclusiveSystemParam for Local<'_s, T>
}
}

impl<S: ?Sized> ExclusiveSystemParam for PhantomData<S> {
type State = ();
type Item<'s> = PhantomData<S>;

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)]
Expand Down

0 comments on commit 8d23a5b

Please sign in to comment.