Clarify the behaviour of iter_many in the docs (#5973)
Add the following message: ``` Items are returned in the order of the list of entities. Entities that don't match the query are skipped. ``` Additionally, the docs in `iter.rs` and `state.rs` were updated to match those in `query.rs`. Co-authored-by: devil-ira <justthecooldude@gmail.com>
This commit is contained in:
parent
c19aa5939d
commit
e4af823b45
@ -72,7 +72,10 @@ impl<'w, 's, Q: WorldQuery, F: ReadOnlyWorldQuery> Iterator for QueryIter<'w, 's
|
||||
// This is correct as [`QueryIter`] always returns `None` once exhausted.
|
||||
impl<'w, 's, Q: WorldQuery, F: ReadOnlyWorldQuery> FusedIterator for QueryIter<'w, 's, Q, F> {}
|
||||
|
||||
/// An [`Iterator`] over [`Query`](crate::system::Query) results of a list of [`Entity`]s.
|
||||
/// An [`Iterator`] over the query items generated from an iterator of [`Entity`]s.
|
||||
///
|
||||
/// Items are returned in the order of the provided iterator.
|
||||
/// Entities that don't match the query are skipped.
|
||||
///
|
||||
/// This struct is created by the [`Query::iter_many`](crate::system::Query::iter_many) and [`Query::iter_many_mut`](crate::system::Query::iter_many_mut) methods.
|
||||
pub struct QueryManyIter<'w, 's, Q: WorldQuery, F: ReadOnlyWorldQuery, I: Iterator>
|
||||
|
||||
@ -605,11 +605,14 @@ impl<Q: WorldQuery, F: ReadOnlyWorldQuery> QueryState<Q, F> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns an [`Iterator`] over the query results of a list of [`Entity`]'s.
|
||||
/// Returns an [`Iterator`] over the read-only query items generated from an [`Entity`] list.
|
||||
///
|
||||
/// This can only return immutable data (mutable data will be cast to an immutable form).
|
||||
/// See [`Self::iter_many_mut`] for queries that contain at least one mutable component.
|
||||
/// Items are returned in the order of the list of entities.
|
||||
/// Entities that don't match the query are skipped.
|
||||
///
|
||||
/// # See also
|
||||
///
|
||||
/// - [`iter_many_mut`](Self::iter_many_mut) to get mutable query items.
|
||||
#[inline]
|
||||
pub fn iter_many<'w, 's, EntityList: IntoIterator>(
|
||||
&'s mut self,
|
||||
@ -631,7 +634,10 @@ impl<Q: WorldQuery, F: ReadOnlyWorldQuery> QueryState<Q, F> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns an iterator over the query results of a list of [`Entity`]'s.
|
||||
/// Returns an iterator over the query items generated from an [`Entity`] list.
|
||||
///
|
||||
/// Items are returned in the order of the list of entities.
|
||||
/// Entities that don't match the query are skipped.
|
||||
#[inline]
|
||||
pub fn iter_many_mut<'w, 's, EntityList: IntoIterator>(
|
||||
&'s mut self,
|
||||
|
||||
@ -467,6 +467,9 @@ impl<'w, 's, Q: WorldQuery, F: ReadOnlyWorldQuery> Query<'w, 's, Q, F> {
|
||||
|
||||
/// Returns an [`Iterator`] over the read-only query items generated from an [`Entity`] list.
|
||||
///
|
||||
/// Items are returned in the order of the list of entities.
|
||||
/// Entities that don't match the query are skipped.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
@ -518,7 +521,10 @@ impl<'w, 's, Q: WorldQuery, F: ReadOnlyWorldQuery> Query<'w, 's, Q, F> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns an [`Iterator`] over the query items generated from an [`Entity`] list.
|
||||
/// Returns an iterator over the query items generated from an [`Entity`] list.
|
||||
///
|
||||
/// Items are returned in the order of the list of entities.
|
||||
/// Entities that don't match the query are skipped.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
||||
Loading…
Reference in New Issue
Block a user