summaryrefslogtreecommitdiff
path: root/ecs/src/entity.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2025-08-20 17:09:08 +0200
committerHampusM <hampus@hampusmat.com>2025-08-20 17:09:08 +0200
commit29ee29b3887773e36fb7ad55ab44392dae7f8412 (patch)
tree296b1ad0b2f04f0f577e6e5643e27a9222f7cf66 /ecs/src/entity.rs
parent5c9113431ea22c53cc59324c93ec3dc6efdfe926 (diff)
feat(ecs): add funcs for getting target comp of wildcard pairs
Diffstat (limited to 'ecs/src/entity.rs')
-rw-r--r--ecs/src/entity.rs18
1 files changed, 10 insertions, 8 deletions
diff --git a/ecs/src/entity.rs b/ecs/src/entity.rs
index ef91d20..6c9ec32 100644
--- a/ecs/src/entity.rs
+++ b/ecs/src/entity.rs
@@ -48,12 +48,14 @@ impl<'a> Handle<'a>
let component = self.get_matching_components(ComponentT::id()).next()?;
Some(
- ComponentHandle::from_entity_component_ref(component).unwrap_or_else(|err| {
- panic!(
- "Taking component {} lock failed: {err}",
- type_name::<ComponentT>()
- );
- }),
+ ComponentHandle::from_entity_component_ref(&component).unwrap_or_else(
+ |err| {
+ panic!(
+ "Creating handle to component {} failed: {err}",
+ type_name::<ComponentT>()
+ );
+ },
+ ),
)
}
@@ -74,10 +76,10 @@ impl<'a> Handle<'a>
let component = self.get_matching_components(ComponentT::id()).next()?;
Some(
- ComponentHandleMut::from_entity_component_ref(component).unwrap_or_else(
+ ComponentHandleMut::from_entity_component_ref(&component).unwrap_or_else(
|err| {
panic!(
- "Taking component {} lock failed: {err}",
+ "Creating handle to component {} failed: {err}",
type_name::<ComponentT>()
);
},