diff options
Diffstat (limited to 'ecs/src/component.rs')
-rw-r--r-- | ecs/src/component.rs | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/ecs/src/component.rs b/ecs/src/component.rs index 77046d0..dc60995 100644 --- a/ecs/src/component.rs +++ b/ecs/src/component.rs @@ -39,9 +39,6 @@ pub trait Component: SystemInput + Any + TypeName where Self: Sized; - /// The ID of the component `self`. Returns the same value as [`Component::id`]. - fn self_id(&self) -> Uid; - /// Returns the component UID of a component event for this component. fn get_event_uid(&self, event_kind: ComponentEventKind) -> Uid; @@ -116,11 +113,6 @@ where ComponentT::id() } - fn self_id(&self) -> Uid - { - Self::id() - } - fn get_event_uid(&self, event_kind: ComponentEventKind) -> Uid { match event_kind { @@ -167,7 +159,7 @@ pub trait Sequence /// The number of components in this component sequence. const COUNT: usize; - type Array: Array<Box<dyn Component>>; + type Array: Array<(Uid, Box<dyn Component>)>; fn into_array(self) -> Self::Array; @@ -235,15 +227,6 @@ impl Metadata } #[must_use] - pub fn get<ComponentT: Component + ?Sized>(component: &ComponentT) -> Self - { - Self { - id: component.self_id(), - is_optional: component.self_is_optional(), - } - } - - #[must_use] pub fn of<ComponentT: Component>() -> Self { Self { @@ -291,11 +274,11 @@ macro_rules! inner { { const COUNT: usize = $c + 1; - type Array = [Box<dyn Component>; $c + 1]; + type Array = [(Uid, Box<dyn Component>); $c + 1]; fn into_array(self) -> Self::Array { - [#(Box::new(self.I) as Box<dyn Component>,)*] + [#((Comp~I::id(), Box::new(self.I) as Box<dyn Component>),)*] } fn metadata() -> impl Array<Metadata> @@ -372,7 +355,7 @@ seq!(C in 0..=16 { impl Sequence for () { - type Array = [Box<dyn Component>; 0]; + type Array = [(Uid, Box<dyn Component>); 0]; const COUNT: usize = 0; |