diff options
author | HampusM <hampus@hampusmat.com> | 2025-01-10 15:09:33 +0100 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2025-01-10 15:09:33 +0100 |
commit | ab2fa8a93de33ccb17ee1efd6f9b8858a8b79253 (patch) | |
tree | ae648720e075dd5862805ef7457748d417b18985 /ecs/src/component.rs | |
parent | 49d954830c1872461b779847907328d50e4364e9 (diff) |
refactor(ecs): add struct for querying using component metadata
Diffstat (limited to 'ecs/src/component.rs')
-rw-r--r-- | ecs/src/component.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/ecs/src/component.rs b/ecs/src/component.rs index 4d37cb8..35e5430 100644 --- a/ecs/src/component.rs +++ b/ecs/src/component.rs @@ -180,7 +180,9 @@ pub trait RefSequence { type Handles<'component>; - fn metadata() -> impl Array<Metadata>; + type Metadata: Array<Metadata>; + + fn metadata() -> Self::Metadata; fn from_components<'component>( components: &'component [EntityComponent], @@ -330,7 +332,9 @@ macro_rules! inner { { type Handles<'component> = (#(CompRef~I::Handle<'component>,)*); - fn metadata() -> impl Array<Metadata> + type Metadata = [Metadata; $c + 1]; + + fn metadata() -> Self::Metadata { [#( Metadata { @@ -397,8 +401,9 @@ impl Sequence for () impl RefSequence for () { type Handles<'component> = (); + type Metadata = [Metadata; 0]; - fn metadata() -> impl Array<Metadata> + fn metadata() -> Self::Metadata { [] } |