diff options
Diffstat (limited to 'engine-ecs/src/sole.rs')
| -rw-r--r-- | engine-ecs/src/sole.rs | 34 |
1 files changed, 2 insertions, 32 deletions
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<Real: 'static>(&mut self) -> Option<&mut Real> - { - (self as &mut dyn Any).downcast_mut() - } - - pub fn downcast_ref<Real: 'static>(&self) -> Option<&Real> - { - (self as &dyn Any).downcast_ref() - } - - pub fn is<Other: 'static>(&self) -> bool - { - (self as &dyn Any).is::<Other>() - } -} - -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> |
