From 29ee29b3887773e36fb7ad55ab44392dae7f8412 Mon Sep 17 00:00:00 2001 From: HampusM Date: Wed, 20 Aug 2025 17:09:08 +0200 Subject: feat(ecs): add funcs for getting target comp of wildcard pairs --- ecs/src/entity.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'ecs/src/entity.rs') 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::() - ); - }), + ComponentHandle::from_entity_component_ref(&component).unwrap_or_else( + |err| { + panic!( + "Creating handle to component {} failed: {err}", + type_name::() + ); + }, + ), ) } @@ -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::() ); }, -- cgit v1.2.3-18-g5258