1use crate::*;
3
4pub trait NodeComponent: Downcast {
6 fn is_of_type(&self, ctype: TypeId) -> bool {
8 self.type_id() == ctype
9 }
10
11 fn get_component_name(&self) -> &str;
18}
19
20impl<C: Sized + 'static> NodeComponent for C where C: Sized {
22 fn get_component_name(&self) -> &str {
23 std::any::type_name::<C>()
24 }
25}
26
27pub trait NodeComponentSync: NodeComponent + DowncastSync + Send + Sync {
29 }
31
32impl<C: NodeComponent> NodeComponentSync for C where C: Send + Sync {}
34
35pub type NodeComponentBox = Box<dyn NodeComponent>;
37
38use downcast_rs::impl_downcast;
40impl_downcast!(NodeComponent);
41impl_downcast!(NodeComponentSync);