From 98d47caa57a9484d39ee4f8d145255d6f5088eac Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 29 Nov 2026 21:30:53 +0100 Subject: feat(engine-ecs): add component type name to component::Info --- engine-ecs/src/component.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'engine-ecs/src/component.rs') diff --git a/engine-ecs/src/component.rs b/engine-ecs/src/component.rs index 3e93930..f27718d 100644 --- a/engine-ecs/src/component.rs +++ b/engine-ecs/src/component.rs @@ -264,6 +264,7 @@ pub struct Parts { pub id: Uid, pub name: Cow<'static, str>, + pub type_name: &'static str, pub is_sole: bool, pub type_reflection: Option<&'static TypeReflection>, pub data: Box, @@ -288,6 +289,7 @@ impl Parts Self::builder() .type_reflection(component_info.type_reflection) .name(component_info.name.clone()) + .type_name(component_info.type_name) .is_sole(component_info.is_sole) .build_with_any_data(id, data) } @@ -311,6 +313,7 @@ impl IntoParts for Parts pub struct PartsBuilder { name: Cow<'static, str>, + type_name: &'static str, is_sole: bool, type_reflection: Option<&'static TypeReflection>, pair_relation_metadata: Option, @@ -326,6 +329,13 @@ impl PartsBuilder self } + #[must_use] + pub fn type_name(mut self, type_name: &'static str) -> Self + { + self.type_name = type_name.into(); + self + } + #[must_use] pub fn is_sole(mut self, is_sole: bool) -> Self { @@ -364,6 +374,7 @@ impl PartsBuilder Parts { id, name: self.name, + type_name: self.type_name, is_sole: self.is_sole, type_reflection: self.type_reflection, data: Box::new(data), @@ -378,6 +389,7 @@ impl PartsBuilder Parts { id, name: self.name, + type_name: self.type_name, is_sole: self.is_sole, type_reflection: self.type_reflection, data, @@ -393,6 +405,7 @@ impl Default for PartsBuilder { Self { name: "".into(), + type_name: "", is_sole: false, type_reflection: None, pair_relation_metadata: None, @@ -408,6 +421,7 @@ pub struct Info pub type_reflection: Option<&'static TypeReflection>, pub ty_id: TypeId, pub name: Cow<'static, str>, + pub type_name: &'static str, pub is_sole: bool, } -- cgit v1.2.3-18-g5258