From ab2fa8a93de33ccb17ee1efd6f9b8858a8b79253 Mon Sep 17 00:00:00 2001 From: HampusM Date: Fri, 10 Jan 2025 15:09:33 +0100 Subject: refactor(ecs): add struct for querying using component metadata --- ecs/src/component.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'ecs/src/component.rs') 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; + type Metadata: Array; + + 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 + 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 + fn metadata() -> Self::Metadata { [] } -- cgit v1.2.3-18-g5258