Skip to content

Commit

Permalink
Basic docs
Browse files Browse the repository at this point in the history
  • Loading branch information
alice-i-cecile committed Mar 22, 2022
1 parent 34e92c7 commit 063e616
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
10 changes: 10 additions & 0 deletions crates/bevy_ecs/src/query/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ where
}
}

/// Returns the read-only query results for the given array of [`Entity`].
///
/// In case of a nonexisting entity or mismatched component, a [`QueryEntityError`] is
/// returned instead.
///
/// Note that the unlike [`QueryState::get_multiple_mut`], the entities passed in do not need to be unique.
#[inline]
pub fn get_multiple<'w, 's, const N: usize>(
&'s mut self,
Expand Down Expand Up @@ -203,6 +209,10 @@ where
}
}

/// Returns the query results for the given array of [`Entity`].
///
/// In case of a nonexisting entity or mismatched component, a [`QueryEntityError`] is
/// returned instead.
#[inline]
pub fn get_multiple_mut<'w, 's, const N: usize>(
&'s mut self,
Expand Down
12 changes: 12 additions & 0 deletions crates/bevy_ecs/src/system/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,12 @@ where
}
}

/// Returns the read-only query results for the given array of [`Entity`].
///
/// In case of a nonexisting entity or mismatched component, a [`QueryEntityError`] is
/// returned instead.
///
/// Note that the unlike [`Query::get_multiple_mut`], the entities passed in do not need to be unique.
#[inline]
pub fn get_multiple<const N: usize>(
&'s self,
Expand Down Expand Up @@ -646,6 +652,7 @@ where
Ok(array_of_results.map(|result| result.unwrap()))
}

/// Returns the read-only query items for the provided array of [`Entity`]
#[inline]
pub fn multiple<const N: usize>(
&'s self,
Expand Down Expand Up @@ -695,6 +702,10 @@ where
}
}

/// Returns the query results for the given array of [`Entity`].
///
/// In case of a nonexisting entity, duplicate entities or mismatched component, a [`QueryEntityError`] is
/// returned instead.
#[inline]
pub fn get_multiple_mut<const N: usize>(
&'s mut self,
Expand Down Expand Up @@ -733,6 +744,7 @@ where
Ok(array_of_results.map(|result| result.unwrap()))
}

/// Returns the query items for the provided array of [`Entity`]
#[inline]
pub fn multiple_mut<const N: usize>(
&'s mut self,
Expand Down

0 comments on commit 063e616

Please sign in to comment.