diff options
Diffstat (limited to 'engine-ecs-macros')
| -rw-r--r-- | engine-ecs-macros/src/lib.rs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/engine-ecs-macros/src/lib.rs b/engine-ecs-macros/src/lib.rs index a061165..1cae24b 100644 --- a/engine-ecs-macros/src/lib.rs +++ b/engine-ecs-macros/src/lib.rs @@ -130,22 +130,22 @@ pub fn component_derive(input: TokenStream) -> TokenStream { } - impl #ecs_path::component::IntoParts for #item_ident + impl From<#item_ident> for #ecs_path::component::Parts { - fn into_parts(self) -> #ecs_path::component::Parts + fn from(component: #item_ident) -> Self { #ecs_path::component::Parts::builder() .component_info( #ecs_path::component::Info::default() - .with_name(<Self as Component>::name()) - .with_type_name(std::any::type_name::<Self>()) + .with_name(<#item_ident as Component>::name()) + .with_type_name(std::any::type_name::<#item_ident>()) .with_type_reflection( - <Self as Component>::type_reflection() + <#item_ident as Component>::type_reflection() ) ) .build( - <Self as #ecs_path::component::WithAssociatedId>::id(), - self + <#item_ident as #ecs_path::component::WithAssociatedId>::id(), + component ) } } @@ -257,22 +257,22 @@ pub fn sole_derive(input: TokenStream) -> TokenStream } } - impl #ecs_path::component::IntoParts for #item_ident + impl From<#item_ident> for #ecs_path::component::Parts { - fn into_parts(self) -> #ecs_path::component::Parts + fn from(sole: #item_ident) -> Self { #ecs_path::component::Parts::builder() .component_info( #ecs_path::component::Info::default() - .with_name(<Self as Sole>::name()) - .with_type_name(std::any::type_name::<Self>()) + .with_name(<#item_ident as Sole>::name()) + .with_type_name(std::any::type_name::<#item_ident>()) .with_is_sole(true) - .with_type_reflection(<Self as Sole>::type_reflection()) + .with_type_reflection(<#item_ident as Sole>::type_reflection()) ) .is_sole(true) .build( - <Self as #ecs_path::component::WithAssociatedId>::id(), - self + <#item_ident as #ecs_path::component::WithAssociatedId>::id(), + sole ) } } |
