summaryrefslogtreecommitdiff
path: root/ecs-macros/src
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2024-06-16 13:18:58 +0200
committerHampusM <hampus@hampusmat.com>2024-06-16 13:18:58 +0200
commit720f806b7fa770664c3ebdf2ce3ec9fdeb69bbcf (patch)
tree916e116ec306c4cc2cbb0872f79012ef17e1005d /ecs-macros/src
parentd50a2f6e63c25adf3b64652310c423717bd3966f (diff)
chore(ecs-macros): add id function to component impls
Diffstat (limited to 'ecs-macros/src')
-rw-r--r--ecs-macros/src/lib.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/ecs-macros/src/lib.rs b/ecs-macros/src/lib.rs
index a3ddc2a..21e8053 100644
--- a/ecs-macros/src/lib.rs
+++ b/ecs-macros/src/lib.rs
@@ -59,6 +59,11 @@ pub fn component_derive(input: TokenStream) -> TokenStream
type RefMut<'component> =
#ecs_path::system::ComponentRefMut<'component, Self>;
+ fn id(&self) -> #ecs_path::component::Id
+ {
+ #ecs_path::component::Id::of::<Self>()
+ }
+
fn as_any_mut(&mut self) -> &mut dyn std::any::Any
{
self