Skip to content

Commit

Permalink
Remove the last things required for Config
Browse files Browse the repository at this point in the history
  • Loading branch information
DJMcNab committed Jan 10, 2022
1 parent 64a6d45 commit b598241
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 127 deletions.
14 changes: 3 additions & 11 deletions crates/bevy_ecs/macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,7 @@ pub fn impl_query_set(_input: TokenStream) -> TokenStream {
unsafe impl<#(#query: WorldQuery + 'static,)* #(#filter: WorldQuery + 'static,)*> SystemParamState for QuerySetState<(#(QueryState<#query, #filter>,)*)>
where #(#filter::Fetch: FilterFetch,)*
{
type Config = ();
fn init(world: &mut World, system_meta: &mut SystemMeta, config: Self::Config) -> Self {
fn init(world: &mut World, system_meta: &mut SystemMeta) -> Self {
#(
let mut #query = QueryState::<#query, #filter>::new(world);
assert_component_access_compatibility(
Expand Down Expand Up @@ -257,8 +256,6 @@ pub fn impl_query_set(_input: TokenStream) -> TokenStream {
.extend(&#query.archetype_component_access);
)*
}

fn default_config() {}
}

impl<'w, 's, #(#query: WorldQuery + 'static,)* #(#filter: WorldQuery + 'static,)*> SystemParamFetch<'w, 's> for QuerySetState<(#(QueryState<#query, #filter>,)*)>
Expand Down Expand Up @@ -388,10 +385,9 @@ pub fn derive_system_param(input: TokenStream) -> TokenStream {
}

unsafe impl<TSystemParamState: #path::system::SystemParamState, #punctuated_generics> #path::system::SystemParamState for #fetch_struct_name<TSystemParamState, #punctuated_generic_idents> {
type Config = TSystemParamState::Config;
fn init(world: &mut #path::world::World, system_meta: &mut #path::system::SystemMeta, config: Self::Config) -> Self {
fn init(world: &mut #path::world::World, system_meta: &mut #path::system::SystemMeta) -> Self {
Self {
state: TSystemParamState::init(world, system_meta, config),
state: TSystemParamState::init(world, system_meta),
marker: std::marker::PhantomData,
}
}
Expand All @@ -400,10 +396,6 @@ pub fn derive_system_param(input: TokenStream) -> TokenStream {
self.state.new_archetype(archetype, system_meta)
}

fn default_config() -> TSystemParamState::Config {
TSystemParamState::default_config()
}

fn apply(&mut self, world: &mut #path::world::World) {
self.state.apply(world)
}
Expand Down
13 changes: 1 addition & 12 deletions crates/bevy_ecs/src/system/function_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,8 @@ pub struct SystemState<Param: SystemParam> {

impl<Param: SystemParam> SystemState<Param> {
pub fn new(world: &mut World) -> Self {
let config = <Param::Fetch as SystemParamState>::default_config();
Self::with_config(world, config)
}

pub fn with_config(
world: &mut World,
config: <Param::Fetch as SystemParamState>::Config,
) -> Self {
let mut meta = SystemMeta::new::<Param>();
let param_state = <Param::Fetch as SystemParamState>::init(world, &mut meta, config);
let param_state = <Param::Fetch as SystemParamState>::init(world, &mut meta);
Self {
meta,
param_state,
Expand Down Expand Up @@ -311,7 +303,6 @@ where
func: F,
param_state: Option<Param::Fetch>,
system_meta: SystemMeta,
config: Option<<Param::Fetch as SystemParamState>::Config>,
// NOTE: PhantomData<fn()-> T> gives this safe Send/Sync impls
#[allow(clippy::type_complexity)]
marker: PhantomData<fn() -> (In, Out, Marker)>,
Expand All @@ -332,7 +323,6 @@ where
FunctionSystem {
func: self,
param_state: None,
config: Some(<Param::Fetch as SystemParamState>::default_config()),
system_meta: SystemMeta::new::<F>(),
marker: PhantomData,
}
Expand Down Expand Up @@ -401,7 +391,6 @@ where
self.param_state = Some(<Param::Fetch as SystemParamState>::init(
world,
&mut self.system_meta,
self.config.take().unwrap(),
));
}

Expand Down
Loading

0 comments on commit b598241

Please sign in to comment.