diff options
| author | HampusM <hampus@hampusmat.com> | 2026-07-05 01:04:56 +0200 |
|---|---|---|
| committer | HampusM <hampus@hampusmat.com> | 2026-07-05 01:04:56 +0200 |
| commit | 02ee21f4571cda15d4bf0ee42128709cfab0485b (patch) | |
| tree | 7778610c85acf9b5e8d495aa17319102ea47afca /engine-macros/src | |
| parent | 9d2d0712511b1cc015e99cd448a3c52663a1da36 (diff) | |
feat(engine): add get_variant_reflection fn to enum reflection
Diffstat (limited to 'engine-macros/src')
| -rw-r--r-- | engine-macros/src/reflection/enum_impl.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/engine-macros/src/reflection/enum_impl.rs b/engine-macros/src/reflection/enum_impl.rs index baf1732..f46b977 100644 --- a/engine-macros/src/reflection/enum_impl.rs +++ b/engine-macros/src/reflection/enum_impl.rs @@ -166,7 +166,17 @@ fn generate_impls( get_default_value: || { #get_default_value_fn }, - cast_dyn_any: |ptr| ptr.cast::<Self>() + cast_dyn_any: |ptr| ptr.cast::<Self>(), + get_variant_reflection: |target| { + use std::any::Any; + use #engine_crate_path::reflection::EnumReflectionExt; + + let target = target.downcast_ref::<Self>()?; + + Some(<Self as EnumReflectionExt>::get_variant_reflection( + target + )) + } } ) }; |
