summaryrefslogtreecommitdiff
path: root/engine-macros
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2026-06-23 00:19:05 +0200
committerHampusM <hampus@hampusmat.com>2026-06-23 00:25:40 +0200
commit172bf5b905c6ab82e96f5ef8a14ff3bc9193f7ad (patch)
tree54a23f599a0d55336d0a4b121da3e27963ea75e7 /engine-macros
parente12391a0861d61a19516f212edd49ad78b65104e (diff)
feat(engine): add type reflection fn for casting to dyn Any
Diffstat (limited to 'engine-macros')
-rw-r--r--engine-macros/src/reflection/enum_impl.rs3
-rw-r--r--engine-macros/src/reflection/struct_impl.rs3
2 files changed, 4 insertions, 2 deletions
diff --git a/engine-macros/src/reflection/enum_impl.rs b/engine-macros/src/reflection/enum_impl.rs
index 9d53d8e..41aa673 100644
--- a/engine-macros/src/reflection/enum_impl.rs
+++ b/engine-macros/src/reflection/enum_impl.rs
@@ -165,7 +165,8 @@ fn generate_impls(
tagged_union: #tagged_union,
get_default_value: || {
#get_default_value_fn
- }
+ },
+ cast_dyn_any: |ptr| ptr.cast::<Self>()
}
)
};
diff --git a/engine-macros/src/reflection/struct_impl.rs b/engine-macros/src/reflection/struct_impl.rs
index 58046fe..4fbf88b 100644
--- a/engine-macros/src/reflection/struct_impl.rs
+++ b/engine-macros/src/reflection/struct_impl.rs
@@ -88,7 +88,8 @@ fn gen_impl(
],
get_default_value: || {
#get_default_value_fn
- }
+ },
+ cast_dyn_any: |ptr| ptr.cast::<Self>()
}
)
};