From 723f48d8e008d216978b8ed7d70499c972cc5a1c Mon Sep 17 00:00:00 2001 From: HampusM Date: Fri, 30 Oct 2026 05:24:39 +0100 Subject: refactor(engine-ecs): replace uid::WithUid* traits with new component traits --- engine-ecs/src/sole.rs | 34 ++-------------------------------- 1 file changed, 2 insertions(+), 32 deletions(-) (limited to 'engine-ecs/src/sole.rs') diff --git a/engine-ecs/src/sole.rs b/engine-ecs/src/sole.rs index 4047b48..9168414 100644 --- a/engine-ecs/src/sole.rs +++ b/engine-ecs/src/sole.rs @@ -4,18 +4,14 @@ use std::fmt::Debug; use crate::component::{ HandleMut as ComponentHandleMut, IntoParts as IntoComponentParts, + WithAssociatedId as ComponentWithAssociatedId, }; use crate::system::{Metadata as SystemMetadata, Param as SystemParam}; -use crate::uid::Uid; use crate::World; /// A component which has a single instance in the [`World`]. -pub trait Sole: Any + IntoComponentParts +pub trait Sole: Any + IntoComponentParts + ComponentWithAssociatedId { - fn id() -> Uid - where - Self: Sized; - fn type_reflection() -> Option<&'static crate::reflection::Type> where Self: Sized; @@ -24,32 +20,6 @@ pub trait Sole: Any + IntoComponentParts fn name(&self) -> &'static str; } -impl dyn Sole -{ - pub fn downcast_mut(&mut self) -> Option<&mut Real> - { - (self as &mut dyn Any).downcast_mut() - } - - pub fn downcast_ref(&self) -> Option<&Real> - { - (self as &dyn Any).downcast_ref() - } - - pub fn is(&self) -> bool - { - (self as &dyn Any).is::() - } -} - -impl Debug for dyn Sole -{ - fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result - { - formatter.debug_struct("Sole").finish_non_exhaustive() - } -} - /// Holds a reference to a singleton component. #[derive(Debug)] pub struct Single<'world, SoleT: Sole> -- cgit v1.2.3-18-g5258