aboutsummaryrefslogtreecommitdiff
path: root/azalea-client/src/entity_query.rs
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2023-02-05 14:31:52 -0600
committermat <github@matdoes.dev>2023-02-05 14:31:52 -0600
commit0d3a091c232d409939db82dfb30f700e57583c85 (patch)
tree592c3734d824fb2a5cc25d07a997c98239b7d99c /azalea-client/src/entity_query.rs
parenta72b76839782b26e49598313bb04c5d322a34788 (diff)
downloadazalea-drasl-0d3a091c232d409939db82dfb30f700e57583c85.tar.xz
improve docs
Diffstat (limited to 'azalea-client/src/entity_query.rs')
-rw-r--r--azalea-client/src/entity_query.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/azalea-client/src/entity_query.rs b/azalea-client/src/entity_query.rs
index 0e486741..7ac0e325 100644
--- a/azalea-client/src/entity_query.rs
+++ b/azalea-client/src/entity_query.rs
@@ -12,6 +12,15 @@ use crate::Client;
impl Client {
/// A convenience function for getting components of our player's entity.
+ ///
+ /// # Examples
+ /// ```
+ /// # fn example(mut client: azalea_client::Client) {
+ /// let is_logged_in = client
+ /// .query::<Option<&WorldName>>(&mut client.ecs.lock())
+ /// .is_some();
+ /// # }
+ /// ```
pub fn query<'w, Q: WorldQuery>(&self, ecs: &'w mut Ecs) -> <Q as WorldQuery>::Item<'w> {
ecs.query::<Q>()
.get_mut(ecs, self.entity)