summaryrefslogtreecommitdiff
path: root/engine-macros/src/reflection/struct_impl.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2026-06-16 19:07:36 +0200
committerHampusM <hampus@hampusmat.com>2026-06-16 19:20:17 +0200
commitc79f7883c099f1624f9666fb8691ffc5022c1bf5 (patch)
treedd3c4689377d178d1efa993fb2c21d2cc733f49f /engine-macros/src/reflection/struct_impl.rs
parent166da477e761416a87ffd5fb8fc49ceaf7f53690 (diff)
feat(engine): add default value retrieval to type reflectionHEADmaster
Diffstat (limited to 'engine-macros/src/reflection/struct_impl.rs')
-rw-r--r--engine-macros/src/reflection/struct_impl.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/engine-macros/src/reflection/struct_impl.rs b/engine-macros/src/reflection/struct_impl.rs
index b1adea5..ce1086b 100644
--- a/engine-macros/src/reflection/struct_impl.rs
+++ b/engine-macros/src/reflection/struct_impl.rs
@@ -1,5 +1,6 @@
use quote::quote;
+use crate::reflection::default_value::gen_get_default_value_fn;
use crate::reflection::field::{generate as generate_field, ReflectionFieldGenOptions};
use crate::util::{find_engine_crate_path, syn_path, SynPathExt};
@@ -49,6 +50,8 @@ pub fn generate(input: syn::ItemStruct) -> proc_macro2::TokenStream
)
});
+ let get_default_value_fn = gen_get_default_value_fn(&input_ident, &type_generics);
+
quote! {
unsafe impl #impl_generics #engine_crate_path::reflection::Reflection for
#input_ident #type_generics #where_clause
@@ -59,7 +62,10 @@ pub fn generate(input: syn::ItemStruct) -> proc_macro2::TokenStream
#engine_crate_path::reflection::Struct {
fields: &[
#(#fields),*
- ]
+ ],
+ get_default_value: || {
+ #get_default_value_fn
+ }
}
)
};