summaryrefslogtreecommitdiff
path: root/engine-ecs/src/component.rs
diff options
context:
space:
mode:
Diffstat (limited to 'engine-ecs/src/component.rs')
-rw-r--r--engine-ecs/src/component.rs14
1 files changed, 14 insertions, 0 deletions
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<dyn Any>,
@@ -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<PairMemberMetadata>,
@@ -327,6 +330,13 @@ impl PartsBuilder
}
#[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
{
self.is_sole = is_sole;
@@ -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: "<unspecified>".into(),
+ type_name: "<unspecified>",
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,
}