diff options
author | HampusM <hampus@hampusmat.com> | 2024-06-07 19:55:47 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2024-06-07 19:55:47 +0200 |
commit | bef61b765de52d14a52c3df86f8b3766846be272 (patch) | |
tree | b032d9c440844231e8623e8a0e83b5b95caab4f8 /ecs/src/system.rs | |
parent | 8adf787bca7744344b83dace7997031b07785a25 (diff) |
refactor(ecs): make tuple reduce operation more generic
Diffstat (limited to 'ecs/src/system.rs')
-rw-r--r-- | ecs/src/system.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/ecs/src/system.rs b/ecs/src/system.rs index 6846a16..47872a6 100644 --- a/ecs/src/system.rs +++ b/ecs/src/system.rs @@ -186,13 +186,22 @@ pub struct NoInitParamFlag {} /// A type which can be used as input to a [`System`]. pub trait Input: 'static {} -impl<InputT: Input, Accumulator> TupleReduceElement<Accumulator> for InputT +/// Component tuple reducing operation to get the parameters that takes input. +pub struct ParamWithInputFilter; + +impl<InputT: Input, Accumulator> TupleReduceElement<Accumulator, ParamWithInputFilter> + for InputT where Accumulator: TupleWith<Self>, { type Return = Accumulator::With; } +impl<Accumulator> TupleReduceElement<Accumulator, ParamWithInputFilter> for () +{ + type Return = Accumulator; +} + #[derive(Debug)] pub struct ComponentRefMut<'a, ComponentT: Component> { |