diff options
-rw-r--r-- | ecs-macros/src/lib.rs | 10 | ||||
-rw-r--r-- | ecs/src/component.rs | 22 |
2 files changed, 3 insertions, 29 deletions
diff --git a/ecs-macros/src/lib.rs b/ecs-macros/src/lib.rs index 5af10b9..862b0b1 100644 --- a/ecs-macros/src/lib.rs +++ b/ecs-macros/src/lib.rs @@ -150,16 +150,6 @@ pub fn component_derive(input: TokenStream) -> TokenStream } } } - - fn as_any_mut(&mut self) -> &mut dyn Any - { - self - } - - fn as_any(&self) -> &dyn Any - { - self - } } impl #impl_generics SystemInput for #item_ident #type_generics diff --git a/ecs/src/component.rs b/ecs/src/component.rs index 46fbf8a..525bd98 100644 --- a/ecs/src/component.rs +++ b/ecs/src/component.rs @@ -50,12 +50,6 @@ pub trait Component: SystemInput + Any + TypeName /// Returns the component UID of a component event for this component. fn get_event_uid(&self, event_kind: ComponentEventKind) -> Uid; - #[doc(hidden)] - fn as_any_mut(&mut self) -> &mut dyn Any; - - #[doc(hidden)] - fn as_any(&self) -> &dyn Any; - /// Returns whether the component `self` is optional. fn self_is_optional(&self) -> bool { @@ -76,17 +70,17 @@ impl dyn Component { pub fn downcast_mut<Real: 'static>(&mut self) -> Option<&mut Real> { - self.as_any_mut().downcast_mut() + (self as &mut dyn Any).downcast_mut() } pub fn downcast_ref<Real: 'static>(&self) -> Option<&Real> { - self.as_any().downcast_ref() + (self as &dyn Any).downcast_ref() } pub fn is<Other: 'static>(&self) -> bool { - self.as_any().is::<Other>() + (self as &dyn Any).is::<Other>() } } @@ -128,16 +122,6 @@ where } } - fn as_any_mut(&mut self) -> &mut dyn Any - { - self - } - - fn as_any(&self) -> &dyn Any - { - self - } - fn self_is_optional(&self) -> bool { true |