From bef61b765de52d14a52c3df86f8b3766846be272 Mon Sep 17 00:00:00 2001 From: HampusM Date: Fri, 7 Jun 2024 19:55:47 +0200 Subject: refactor(ecs): make tuple reduce operation more generic --- ecs/src/system/stateful.rs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'ecs/src/system/stateful.rs') diff --git a/ecs/src/system/stateful.rs b/ecs/src/system/stateful.rs index e74c0ee..6c0b554 100644 --- a/ecs/src/system/stateful.rs +++ b/ecs/src/system/stateful.rs @@ -7,11 +7,17 @@ use seq_macro::seq; use crate::component::Component; use crate::lock::Lock; use crate::system::util::check_params_are_compatible; -use crate::system::{ComponentRefMut, Into as IntoSystem, Param, System, TypeErased}; +use crate::system::{ + ComponentRefMut, + Into as IntoSystem, + Param, + ParamWithInputFilter, + System, + TypeErased, +}; use crate::tuple::{ IntoInOptions as TupleIntoInOptions, Reduce as TupleReduce, - ReduceNoOp as TupleReduceNoOp, TakeOptionElementResult as TupleTakeOptionElementResult, WithOptionElements as TupleWithOptionElements, }; @@ -33,10 +39,12 @@ macro_rules! impl_system { Func: Fn(#(TParam~I,)*) + Copy + RefUnwindSafe + UnwindSafe + 'static, #(TParam~I: Param<'world>,)* #(TParam~I::Input: 'static,)* - (#(TParam~I::Input,)*): TupleReduce, - <(#(TParam~I::Input,)*) as TupleReduce>::Out: TupleIntoInOptions + (#(TParam~I::Input,)*): TupleReduce, + <(#(TParam~I::Input,)*) as TupleReduce>::Out: + TupleIntoInOptions { - type Input = <(#(TParam~I::Input,)*) as TupleReduce>::Out; + type Input = + <(#(TParam~I::Input,)*) as TupleReduce>::Out; fn initialize(mut self, input: Self::Input) -> Self { @@ -44,7 +52,7 @@ macro_rules! impl_system { #( if TypeId::of::() != - TypeId::of::() + TypeId::of::<()>() { let input = match option_input.take::() { TupleTakeOptionElementResult::Found(input) => input, -- cgit v1.2.3-18-g5258