summaryrefslogtreecommitdiff
path: root/ecs/src/system/stateful.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2024-06-07 19:55:47 +0200
committerHampusM <hampus@hampusmat.com>2024-06-07 19:55:47 +0200
commitbef61b765de52d14a52c3df86f8b3766846be272 (patch)
treeb032d9c440844231e8623e8a0e83b5b95caab4f8 /ecs/src/system/stateful.rs
parent8adf787bca7744344b83dace7997031b07785a25 (diff)
refactor(ecs): make tuple reduce operation more generic
Diffstat (limited to 'ecs/src/system/stateful.rs')
-rw-r--r--ecs/src/system/stateful.rs20
1 files changed, 14 insertions, 6 deletions
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<ParamWithInputFilter>,
+ <(#(TParam~I::Input,)*) as TupleReduce<ParamWithInputFilter>>::Out:
+ TupleIntoInOptions
{
- type Input = <(#(TParam~I::Input,)*) as TupleReduce>::Out;
+ type Input =
+ <(#(TParam~I::Input,)*) as TupleReduce<ParamWithInputFilter>>::Out;
fn initialize(mut self, input: Self::Input) -> Self
{
@@ -44,7 +52,7 @@ macro_rules! impl_system {
#(
if TypeId::of::<TParam~I::Input>() !=
- TypeId::of::<TupleReduceNoOp>()
+ TypeId::of::<()>()
{
let input = match option_input.take::<TParam~I::Input>() {
TupleTakeOptionElementResult::Found(input) => input,