summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2026-08-31 06:22:11 +0200
committerHampusM <hampus@hampusmat.com>2026-08-31 06:22:11 +0200
commit0a08f7da89b150aa8f6f5a9e7a3514585801b64c (patch)
tree505d5c4b65108c047e99d09169ad1465ef7837ac
parent4988e8aeee39a8ec35d338b3ffdb0d26c89ff6ab (diff)
feat(engine-ecs): add component::Parts::from_component_info fn
-rw-r--r--engine-ecs/src/component.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/engine-ecs/src/component.rs b/engine-ecs/src/component.rs
index cbd45e7..847ecbd 100644
--- a/engine-ecs/src/component.rs
+++ b/engine-ecs/src/component.rs
@@ -303,6 +303,18 @@ pub struct Parts
impl Parts
{
+ pub fn from_component_info(component_info: &Info, id: Uid, data: Box<dyn Any>)
+ -> Self
+ {
+ assert_eq!((*data).type_id(), component_info.ty_id);
+
+ Self::builder()
+ .type_reflection(component_info.type_reflection)
+ .name(component_info.name)
+ .is_sole(component_info.is_sole)
+ .build_with_any_data(id, data)
+ }
+
#[must_use]
pub fn builder() -> PartsBuilder
{