From 5fd57fd630bea256639332f117848d6f1fcfd132 Mon Sep 17 00:00:00 2001 From: mat Date: Fri, 4 Apr 2025 16:05:06 -0430 Subject: don't require mut for functions in Client and add some more convenience functions --- azalea-client/src/entity_query.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'azalea-client/src/entity_query.rs') diff --git a/azalea-client/src/entity_query.rs b/azalea-client/src/entity_query.rs index c711253a..77be68a8 100644 --- a/azalea-client/src/entity_query.rs +++ b/azalea-client/src/entity_query.rs @@ -60,7 +60,7 @@ impl Client { /// /// [`Entity`]: bevy_ecs::entity::Entity pub fn entity_by( - &mut self, + &self, predicate: impl EntityPredicate, ) -> Option { predicate.find(self.ecs.clone()) @@ -71,7 +71,7 @@ impl Client { /// /// If you're trying to get a component for this client, use /// [`Self::component`]. - pub fn entity_component(&mut self, entity: Entity) -> Q { + pub fn entity_component(&self, entity: Entity) -> Q { let mut ecs = self.ecs.lock(); let mut q = ecs.query::<&Q>(); let components = q.get(&ecs, entity).unwrap_or_else(|_| { @@ -86,7 +86,7 @@ impl Client { /// Get a component from an entity, if it exists. This is similar to /// [`Self::entity_component`] but returns an `Option` instead of panicking /// if the component isn't present. - pub fn get_entity_component(&mut self, entity: Entity) -> Option { + pub fn get_entity_component(&self, entity: Entity) -> Option { let mut ecs = self.ecs.lock(); let mut q = ecs.query::<&Q>(); let components = q.get(&ecs, entity).ok(); -- cgit v1.2.3