diff options
| author | HampusM <hampus@hampusmat.com> | 2026-06-18 23:33:07 +0200 |
|---|---|---|
| committer | HampusM <hampus@hampusmat.com> | 2026-06-18 23:33:07 +0200 |
| commit | d6cf708a4fd1caf0f2e193ceb7c23fa8e77cc1db (patch) | |
| tree | 90dec16ff48a5d8c46c4dfd72c9dd4b340153e0e /engine-macros | |
| parent | 48e70075f641181e23847bf7f0ff7ac90cc463a3 (diff) | |
Diffstat (limited to 'engine-macros')
| -rw-r--r-- | engine-macros/src/reflection/enum_impl.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/engine-macros/src/reflection/enum_impl.rs b/engine-macros/src/reflection/enum_impl.rs index 0ce2562..9d53d8e 100644 --- a/engine-macros/src/reflection/enum_impl.rs +++ b/engine-macros/src/reflection/enum_impl.rs @@ -139,6 +139,16 @@ fn generate_impls( let input_ident = &input.ident; + let discriminant_size = if is_unit_only { + quote! { + std::mem::size_of::<Self>() + } + } else { + quote! { + std::mem::size_of::<#mod_name::Discriminant>() + } + }; + quote! { unsafe impl #engine_crate_path::reflection::Reflection for #input_ident #generic_args @@ -151,6 +161,7 @@ fn generate_impls( #engine_crate_path::reflection::Enum { variants: &[#(#variants),*], is_unit_only: #is_unit_only, + discriminant_size: #discriminant_size, tagged_union: #tagged_union, get_default_value: || { #get_default_value_fn |
