diff options
Diffstat (limited to 'ecs/src/entity.rs')
-rw-r--r-- | ecs/src/entity.rs | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/ecs/src/entity.rs b/ecs/src/entity.rs index 562f7ea..196bd01 100644 --- a/ecs/src/entity.rs +++ b/ecs/src/entity.rs @@ -10,7 +10,6 @@ use crate::component::storage::archetype::{ use crate::component::{ Component, Handle as ComponentHandle, - HandleFromEntityComponentRef, HandleMut as ComponentHandleMut, }; use crate::uid::{Kind as UidKind, Uid}; @@ -20,7 +19,7 @@ use crate::{EntityComponentRef, World}; #[derive(Debug)] pub struct Handle<'a> { - world: &'a World, + _world: &'a World, archetype: &'a Archetype, entity: &'a ArchetypeEntity, } @@ -50,13 +49,12 @@ impl<'a> Handle<'a> let component = self.get_matching_components(ComponentT::id()).next()?; Some( - ComponentHandle::from_entity_component_ref(Some(component), self.world) - .unwrap_or_else(|err| { - panic!( - "Taking component {} lock failed: {err}", - type_name::<ComponentT>() - ); - }), + ComponentHandle::from_entity_component_ref(component).unwrap_or_else(|err| { + panic!( + "Taking component {} lock failed: {err}", + type_name::<ComponentT>() + ); + }), ) } @@ -77,13 +75,14 @@ impl<'a> Handle<'a> let component = self.get_matching_components(ComponentT::id()).next()?; Some( - ComponentHandleMut::from_entity_component_ref(Some(component), self.world) - .unwrap_or_else(|err| { + ComponentHandleMut::from_entity_component_ref(component).unwrap_or_else( + |err| { panic!( "Taking component {} lock failed: {err}", type_name::<ComponentT>() ); - }), + }, + ), ) } @@ -104,7 +103,7 @@ impl<'a> Handle<'a> entity: &'a ArchetypeEntity, ) -> Self { - Self { world, archetype, entity } + Self { _world: world, archetype, entity } } } |