diff options
| author | HampusM <hampus@hampusmat.com> | 2026-09-20 19:05:03 +0200 |
|---|---|---|
| committer | HampusM <hampus@hampusmat.com> | 2026-09-20 19:05:03 +0200 |
| commit | fd28c16e6455aeff206543b1d1b6655729aaed07 (patch) | |
| tree | b606fe2ce433abd20116fa553ceedb027ea18cd1 /engine-ecs/src/component.rs | |
| parent | bc1aab63bae307fab30d5c04d947ff95ead9eb0f (diff) | |
refactor(engine-ecs): move & rename component::Sequence to bundle::Bundle
Diffstat (limited to 'engine-ecs/src/component.rs')
| -rw-r--r-- | engine-ecs/src/component.rs | 62 |
1 files changed, 8 insertions, 54 deletions
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<Parts>; - - 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<const LEN: usize> 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 { |
