summaryrefslogtreecommitdiff
path: root/engine-ecs/src/component.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2026-12-02 16:55:17 +0100
committerHampusM <hampus@hampusmat.com>2026-12-02 16:55:17 +0100
commitb35d5288c3169de38fd13a0c3000c251cd8f8195 (patch)
tree1805ce04d1d5c57a0a40719f31e62b206acf6189 /engine-ecs/src/component.rs
parentacb55235c1baed08a106bce3abc5b95b5a12e7aa (diff)
feat(engine-ecs): add module path to component::InfoHEADmaster
Diffstat (limited to 'engine-ecs/src/component.rs')
-rw-r--r--engine-ecs/src/component.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/engine-ecs/src/component.rs b/engine-ecs/src/component.rs
index ce19c09..5e70af8 100644
--- a/engine-ecs/src/component.rs
+++ b/engine-ecs/src/component.rs
@@ -35,6 +35,9 @@ pub trait Component: WithAssociatedId + SystemInput + Any + Into<Parts>
/// Returns the name of this component.
fn name() -> Cow<'static, str>;
+
+ /// Returns the module path of this component.
+ fn module_path() -> &'static str;
}
pub trait WithAssociatedId
@@ -361,6 +364,7 @@ pub struct Info
pub type_reflection: Option<&'static TypeReflection>,
pub name: Cow<'static, str>,
pub type_name: &'static str,
+ pub module_path: &'static str,
pub is_sole: bool,
}
@@ -372,6 +376,7 @@ impl Default for Info
type_reflection: None,
name: "<unspecified>".into(),
type_name: "<unspecified>",
+ module_path: "<unspecified>",
is_sole: false,
}
}
@@ -384,6 +389,7 @@ impl Info
Self::default()
.with_name(ComponentT::name())
.with_type_name(type_name::<ComponentT>())
+ .with_module_path(ComponentT::module_path())
.with_is_sole(false)
.with_type_reflection(ComponentT::type_reflection())
}
@@ -393,6 +399,7 @@ impl Info
Self::default()
.with_name(SoleT::name())
.with_type_name(type_name::<SoleT>())
+ .with_module_path(SoleT::module_path())
.with_is_sole(true)
.with_type_reflection(SoleT::type_reflection())
}
@@ -407,7 +414,14 @@ impl Info
#[must_use]
pub fn with_type_name(mut self, type_name: &'static str) -> Self
{
- self.type_name = type_name.into();
+ self.type_name = type_name;
+ self
+ }
+
+ #[must_use]
+ pub fn with_module_path(mut self, module_path: &'static str) -> Self
+ {
+ self.module_path = module_path;
self
}