summaryrefslogtreecommitdiff
path: root/engine-macros/src
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2026-06-11 18:07:35 +0200
committerHampusM <hampus@hampusmat.com>2026-06-11 18:07:35 +0200
commit2cd3d8fece9e2582abc6b6e70d94f28e3e0921bf (patch)
treeb0b0cdb014e4a5627f3678aa8fd210110258161c /engine-macros/src
parent0918fd95082f3ad4837dec64e6c76d68f06da2fd (diff)
fix(engine): use std::any::type_name for field type name reflection
Diffstat (limited to 'engine-macros/src')
-rw-r--r--engine-macros/src/reflection/field.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/engine-macros/src/reflection/field.rs b/engine-macros/src/reflection/field.rs
index 8572875..7d4e301 100644
--- a/engine-macros/src/reflection/field.rs
+++ b/engine-macros/src/reflection/field.rs
@@ -1,4 +1,4 @@
-use quote::{quote, ToTokens};
+use quote::quote;
use crate::reflection::visibility::generate as generate_visibility;
@@ -29,9 +29,6 @@ pub fn generate(
let field_byte_offset = (options.gen_get_byte_offset)(field);
- // since std::any::type_name as const is not stable yet
- let field_type_name = field_type.to_token_stream().to_string();
-
let field_vis = options.field_vis_override.as_ref().unwrap_or(&field.vis);
let field_reflection_vis = generate_visibility(field_vis, &engine_crate_path);
@@ -43,7 +40,9 @@ pub fn generate(
layout: std::alloc::Layout::new::<#field_type>(),
byte_offset: #field_byte_offset,
type_id: std::any::TypeId::of::<#field_type>(),
- type_name: #field_type_name,
+ get_type_name: #engine_crate_path::reflection::FnWithDebug::new(|| {
+ std::any::type_name::<#field_type>()
+ }),
get_type: #engine_crate_path::reflection::FnWithDebug::new(|| {
struct SpecializationTarget<Field>(std::marker::PhantomData<Field>);