diff options
| author | HampusM <hampus@hampusmat.com> | 2026-11-29 21:16:11 +0100 |
|---|---|---|
| committer | HampusM <hampus@hampusmat.com> | 2026-11-29 21:16:11 +0100 |
| commit | 3c117bcd9455ffbcec5cd59dab37db0786e15e02 (patch) | |
| tree | 0355ba259b51b3d5c9eb7c74cf395461517231fa /engine-ecs-macros | |
| parent | c416eca3cccac2c25ee395469005faca01fdb912 (diff) | |
feat(engine-ecs): change meaning of component name to type identifier
Diffstat (limited to 'engine-ecs-macros')
| -rw-r--r-- | engine-ecs-macros/src/lib.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/engine-ecs-macros/src/lib.rs b/engine-ecs-macros/src/lib.rs index a95cfe4..7dee49f 100644 --- a/engine-ecs-macros/src/lib.rs +++ b/engine-ecs-macros/src/lib.rs @@ -120,9 +120,9 @@ pub fn component_derive(input: TokenStream) -> TokenStream .type_reflection() } - fn name(&self) -> &'static str + fn name() -> std::borrow::Cow<'static, str> { - std::any::type_name::<Self>() + stringify!(#item_ident).into() } } @@ -135,7 +135,7 @@ pub fn component_derive(input: TokenStream) -> TokenStream fn into_parts(self) -> #ecs_path::component::Parts { #ecs_path::component::Parts::builder() - .name(<Self as Component>::name(&self)) + .name(<Self as Component>::name()) .type_reflection(<Self as Component>::type_reflection()) .build( <Self as #ecs_path::component::WithAssociatedId>::id(), @@ -245,9 +245,9 @@ pub fn sole_derive(input: TokenStream) -> TokenStream .type_reflection() } - fn name(&self) -> &'static str + fn name() -> std::borrow::Cow<'static, str> { - std::any::type_name::<Self>() + stringify!(#item_ident).into() } } @@ -256,7 +256,7 @@ pub fn sole_derive(input: TokenStream) -> TokenStream fn into_parts(self) -> #ecs_path::component::Parts { #ecs_path::component::Parts::builder() - .name(<Self as Sole>::name(&self)) + .name(<Self as Sole>::name()) .is_sole(true) .type_reflection(<Self as Sole>::type_reflection()) .build( |
