From 6c0db8d03888edddcd811166b1297ae185f2bfbe Mon Sep 17 00:00:00 2001 From: HampusM Date: Mon, 31 Aug 2026 05:34:28 +0200 Subject: feat(engine-ecs): add whether component is a sole to component::Info --- engine-ecs/src/component.rs | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'engine-ecs/src/component.rs') diff --git a/engine-ecs/src/component.rs b/engine-ecs/src/component.rs index 9220ffb..cbd45e7 100644 --- a/engine-ecs/src/component.rs +++ b/engine-ecs/src/component.rs @@ -294,6 +294,7 @@ pub struct Parts { pub id: Uid, pub name: &'static str, + pub is_sole: bool, pub type_reflection: Option<&'static TypeReflection>, pub data: Box, pub pair_relation_metadata: Option, @@ -313,6 +314,7 @@ impl Parts pub struct PartsBuilder { name: &'static str, + is_sole: bool, type_reflection: Option<&'static TypeReflection>, pair_relation_metadata: Option, pair_target_metadata: Option, @@ -327,6 +329,13 @@ impl PartsBuilder self } + #[must_use] + pub fn is_sole(mut self, is_sole: bool) -> Self + { + self.is_sole = is_sole; + self + } + #[must_use] pub fn type_reflection( mut self, @@ -338,20 +347,15 @@ impl PartsBuilder } #[must_use] - pub fn pair_relation_metadata( - mut self, - metadata: Option, - ) -> Self + pub fn pair_relation_metadata(mut self, metadata: Option) + -> Self { self.pair_relation_metadata = metadata; self } #[must_use] - pub fn pair_target_metadata( - mut self, - metadata: Option, - ) -> Self + pub fn pair_target_metadata(mut self, metadata: Option) -> Self { self.pair_target_metadata = metadata; self @@ -363,6 +367,7 @@ impl PartsBuilder Parts { id, name: self.name, + is_sole: self.is_sole, type_reflection: self.type_reflection, data: Box::new(data), pair_relation_metadata: self.pair_relation_metadata, @@ -376,6 +381,7 @@ impl PartsBuilder Parts { id, name: self.name, + is_sole: self.is_sole, type_reflection: self.type_reflection, data, pair_relation_metadata: self.pair_relation_metadata, @@ -390,6 +396,7 @@ impl Default for PartsBuilder { Self { name: "(unspecified)", + is_sole: false, type_reflection: None, pair_relation_metadata: None, pair_target_metadata: None, @@ -404,4 +411,5 @@ pub struct Info pub type_reflection: Option<&'static TypeReflection>, pub ty_id: TypeId, pub name: &'static str, + pub is_sole: bool, } -- cgit v1.2.3-18-g5258