summaryrefslogtreecommitdiff
path: root/engine-ecs/src
diff options
context:
space:
mode:
Diffstat (limited to 'engine-ecs/src')
-rw-r--r--engine-ecs/src/component.rs16
-rw-r--r--engine-ecs/src/sole.rs3
2 files changed, 18 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
}
diff --git a/engine-ecs/src/sole.rs b/engine-ecs/src/sole.rs
index 568be3e..1430cc2 100644
--- a/engine-ecs/src/sole.rs
+++ b/engine-ecs/src/sole.rs
@@ -19,6 +19,9 @@ pub trait Sole: Any + ComponentWithAssociatedId + Into<ComponentParts>
/// Returns the name of this component.
fn name() -> Cow<'static, str>;
+
+ /// Returns the module path of this component.
+ fn module_path() -> &'static str;
}
/// Marker component for the entities of soles.