summaryrefslogtreecommitdiff
path: root/engine-ecs/src/component.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2026-09-21 23:42:32 +0200
committerHampusM <hampus@hampusmat.com>2026-09-21 23:42:32 +0200
commit7003d9de96824f3e1cb67d56c1c4be883f6e2520 (patch)
tree896578ac2a3250e2bbbc405fbe8e1cf136ab0b90 /engine-ecs/src/component.rs
parentdfa772c8c901500f679249c9a6e0bd25b05ca4d7 (diff)
refactor(engine-ecs): fix clippy lints
Diffstat (limited to 'engine-ecs/src/component.rs')
-rw-r--r--engine-ecs/src/component.rs17
1 files changed, 16 insertions, 1 deletions
diff --git a/engine-ecs/src/component.rs b/engine-ecs/src/component.rs
index c76c48e..400b12c 100644
--- a/engine-ecs/src/component.rs
+++ b/engine-ecs/src/component.rs
@@ -101,6 +101,10 @@ impl<'comp, DataT: 'static> Handle<'comp, DataT>
impl<'comp> Handle<'comp, dyn Any>
{
+ /// Creates a handle to a untyped component.
+ ///
+ /// # Errors
+ /// Will return `Err` if acquiring the component's lock fails.
pub fn new_any(
entity_component_ref: &EntityComponentRef<'comp>,
) -> Result<Self, HandleError>
@@ -164,6 +168,10 @@ impl<'comp, DataT: 'static> HandleMut<'comp, DataT>
impl<'comp> HandleMut<'comp, dyn Any>
{
+ /// Creates a handle to a untyped component.
+ ///
+ /// # Errors
+ /// Will return `Err` if acquiring the component's lock fails.
pub fn new_any(
entity_component_ref: &EntityComponentRef<'comp>,
world: &'comp World,
@@ -182,7 +190,7 @@ impl<'comp> HandleMut<'comp, dyn Any>
}
}
-impl<'comp, DataT: ?Sized + 'static> HandleMut<'comp, DataT>
+impl<DataT: ?Sized + 'static> HandleMut<'_, DataT>
{
pub fn set_changed(&self)
{
@@ -249,6 +257,13 @@ pub struct Parts
impl Parts
{
+ /// Creates components parts from the component information stored in
+ /// `component_info`.
+ ///
+ /// # Panics
+ /// This function will panic if the type ID of the value in `data` does not equal
+ /// to the type ID stored in `component_info`.
+ #[must_use]
pub fn from_component_info(component_info: &Info, id: Uid, data: Box<dyn Any>)
-> Self
{