From fd28c16e6455aeff206543b1d1b6655729aaed07 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 20 Sep 2026 19:05:03 +0200 Subject: refactor(engine-ecs): move & rename component::Sequence to bundle::Bundle --- engine-ecs/src/component.rs | 62 ++++++--------------------------------------- 1 file changed, 8 insertions(+), 54 deletions(-) (limited to 'engine-ecs/src/component.rs') diff --git a/engine-ecs/src/component.rs b/engine-ecs/src/component.rs index 847ecbd..c76c48e 100644 --- a/engine-ecs/src/component.rs +++ b/engine-ecs/src/component.rs @@ -3,7 +3,6 @@ use std::fmt::Debug; use std::ops::{Deref, DerefMut}; use engine_ecs_macros::Component; -use seq_macro::seq; use crate::event::component::Changed; use crate::event::Submitter as EventSubmitter; @@ -18,7 +17,6 @@ use crate::pair::{MemberMetadata as PairMemberMetadata, Pair}; use crate::reflection::Type as TypeReflection; use crate::system::Input as SystemInput; use crate::uid::Uid; -use crate::util::Array; use crate::{EntityComponentRef, World}; pub mod local; @@ -66,16 +64,6 @@ impl Debug for dyn Component } } -/// A sequence of components. -pub trait Sequence -{ - type PartsArray: Array; - - fn cnt(&self) -> usize; - - fn into_parts_array(self) -> Self::PartsArray; -} - #[derive(Debug)] pub struct Handle<'a, DataT: ?Sized + 'static> { @@ -240,48 +228,6 @@ pub enum HandleError #[error("Failed to acquire component lock")] pub struct AcquireLockError(#[source] LockError); -macro_rules! inner { - ($c: tt) => { - seq!(I in 0..$c { - impl<#(IntoCompParts~I: IntoParts,)*> Sequence for (#(IntoCompParts~I,)*) - { - type PartsArray = [Parts; $c]; - - fn cnt(&self) -> usize - { - $c - } - - fn into_parts_array(self) -> Self::PartsArray - { - [#({ - self.I.into_parts() - },)*] - } - } - }); - }; -} - -seq!(C in 0..17 { - inner!(C); -}); - -impl Sequence for [Parts; LEN] -{ - type PartsArray = Self; - - fn cnt(&self) -> usize - { - self.len() - } - - fn into_parts_array(self) -> Self::PartsArray - { - self - } -} - pub trait IntoParts { fn into_parts(self) -> Parts; @@ -322,6 +268,14 @@ impl Parts } } +impl IntoParts for Parts +{ + fn into_parts(self) -> Parts + { + self + } +} + #[derive(Debug)] pub struct PartsBuilder { -- cgit v1.2.3-18-g5258