Struct bevy_ecs::query::QueryState [−][src]
pub struct QueryState<Q: WorldQuery, F: WorldQuery = ()> where
F::Fetch: FilterFetch, { /* fields omitted */ }
Expand description
Provides scoped access to a World
state according to a given WorldQuery
and query filter.
Implementations
Creates a new QueryState
from a given World
and inherits the result of world.id()
.
Checks if the query is empty for the given World
, where the last change and current tick are given.
Takes a query for the given World
, checks if the given world is the same as the query, and
generates new archetypes for the given world.
Panics
Panics if the world.id()
does not equal the current QueryState
internal id.
Creates a new Archetype
.
pub fn get<'w, 's>(
&'s mut self,
world: &'w World,
entity: Entity
) -> Result<<Q::ReadOnlyFetch as Fetch<'w, 's>>::Item, QueryEntityError>
pub fn get<'w, 's>(
&'s mut self,
world: &'w World,
entity: Entity
) -> Result<<Q::ReadOnlyFetch as Fetch<'w, 's>>::Item, QueryEntityError>
Gets the query result for the given World
and Entity
.
This can only be called for read-only queries, see Self::get_mut
for write-queries.
pub fn get_manual<'w, 's>(
&'s self,
world: &'w World,
entity: Entity
) -> Result<<Q::ReadOnlyFetch as Fetch<'w, 's>>::Item, QueryEntityError>
pub unsafe fn get_unchecked<'w, 's>(
&'s mut self,
world: &'w World,
entity: Entity
) -> Result<<Q::Fetch as Fetch<'w, 's>>::Item, QueryEntityError>
pub unsafe fn get_unchecked<'w, 's>(
&'s mut self,
world: &'w World,
entity: Entity
) -> Result<<Q::Fetch as Fetch<'w, 's>>::Item, QueryEntityError>
pub fn iter<'w, 's>(
&'s mut self,
world: &'w World
) -> QueryIter<'w, 's, Q, Q::ReadOnlyFetch, F>ⓘNotable traits for QueryIter<'w, 's, Q, QF, F>impl<'w, 's, Q: WorldQuery, QF, F: WorldQuery> Iterator for QueryIter<'w, 's, Q, QF, F> where
F::Fetch: FilterFetch,
QF: Fetch<'w, 's, State = Q::State>, type Item = QF::Item;
pub fn iter<'w, 's>(
&'s mut self,
world: &'w World
) -> QueryIter<'w, 's, Q, Q::ReadOnlyFetch, F>ⓘNotable traits for QueryIter<'w, 's, Q, QF, F>impl<'w, 's, Q: WorldQuery, QF, F: WorldQuery> Iterator for QueryIter<'w, 's, Q, QF, F> where
F::Fetch: FilterFetch,
QF: Fetch<'w, 's, State = Q::State>, type Item = QF::Item;
impl<'w, 's, Q: WorldQuery, QF, F: WorldQuery> Iterator for QueryIter<'w, 's, Q, QF, F> where
F::Fetch: FilterFetch,
QF: Fetch<'w, 's, State = Q::State>, type Item = QF::Item;
Returns an Iterator
over the query results for the given World
.
This can only be called for read-only queries, see Self::iter_mut
for write-queries.
pub fn iter_mut<'w, 's>(
&'s mut self,
world: &'w mut World
) -> QueryIter<'w, 's, Q, Q::Fetch, F>ⓘNotable traits for QueryIter<'w, 's, Q, QF, F>impl<'w, 's, Q: WorldQuery, QF, F: WorldQuery> Iterator for QueryIter<'w, 's, Q, QF, F> where
F::Fetch: FilterFetch,
QF: Fetch<'w, 's, State = Q::State>, type Item = QF::Item;
pub fn iter_mut<'w, 's>(
&'s mut self,
world: &'w mut World
) -> QueryIter<'w, 's, Q, Q::Fetch, F>ⓘNotable traits for QueryIter<'w, 's, Q, QF, F>impl<'w, 's, Q: WorldQuery, QF, F: WorldQuery> Iterator for QueryIter<'w, 's, Q, QF, F> where
F::Fetch: FilterFetch,
QF: Fetch<'w, 's, State = Q::State>, type Item = QF::Item;
impl<'w, 's, Q: WorldQuery, QF, F: WorldQuery> Iterator for QueryIter<'w, 's, Q, QF, F> where
F::Fetch: FilterFetch,
QF: Fetch<'w, 's, State = Q::State>, type Item = QF::Item;
pub fn iter_manual<'w, 's>(
&'s self,
world: &'w World
) -> QueryIter<'w, 's, Q, Q::ReadOnlyFetch, F>ⓘNotable traits for QueryIter<'w, 's, Q, QF, F>impl<'w, 's, Q: WorldQuery, QF, F: WorldQuery> Iterator for QueryIter<'w, 's, Q, QF, F> where
F::Fetch: FilterFetch,
QF: Fetch<'w, 's, State = Q::State>, type Item = QF::Item;
pub fn iter_manual<'w, 's>(
&'s self,
world: &'w World
) -> QueryIter<'w, 's, Q, Q::ReadOnlyFetch, F>ⓘNotable traits for QueryIter<'w, 's, Q, QF, F>impl<'w, 's, Q: WorldQuery, QF, F: WorldQuery> Iterator for QueryIter<'w, 's, Q, QF, F> where
F::Fetch: FilterFetch,
QF: Fetch<'w, 's, State = Q::State>, type Item = QF::Item;
impl<'w, 's, Q: WorldQuery, QF, F: WorldQuery> Iterator for QueryIter<'w, 's, Q, QF, F> where
F::Fetch: FilterFetch,
QF: Fetch<'w, 's, State = Q::State>, type Item = QF::Item;
Returns an Iterator
over all possible combinations of K
query results without repetition.
This can only be called for read-only queries.
For permutations of size K of query returning N results, you will get:
- if K == N: one permutation of all query results
- if K < N: all possible K-sized combinations of query results, without repetition
- if K > N: empty set (no K-sized combinations exist)
This can only be called for read-only queries, see Self::iter_combinations_mut
for
write-queries.
pub fn iter_combinations<'w, 's, const K: usize>(
&'s mut self,
world: &'w World
) -> QueryCombinationIter<'w, 's, Q, Q::ReadOnlyFetch, F, K>ⓘNotable traits for QueryCombinationIter<'w, 's, Q, QF, F, K>impl<'w, 's, Q: WorldQuery, QF, F: WorldQuery, const K: usize> Iterator for QueryCombinationIter<'w, 's, Q, QF, F, K> where
QF: Fetch<'w, 's, State = Q::State> + Clone + ReadOnlyFetch,
F::Fetch: Clone + FilterFetch + ReadOnlyFetch, type Item = [QF::Item; K];
pub fn iter_combinations<'w, 's, const K: usize>(
&'s mut self,
world: &'w World
) -> QueryCombinationIter<'w, 's, Q, Q::ReadOnlyFetch, F, K>ⓘNotable traits for QueryCombinationIter<'w, 's, Q, QF, F, K>impl<'w, 's, Q: WorldQuery, QF, F: WorldQuery, const K: usize> Iterator for QueryCombinationIter<'w, 's, Q, QF, F, K> where
QF: Fetch<'w, 's, State = Q::State> + Clone + ReadOnlyFetch,
F::Fetch: Clone + FilterFetch + ReadOnlyFetch, type Item = [QF::Item; K];
impl<'w, 's, Q: WorldQuery, QF, F: WorldQuery, const K: usize> Iterator for QueryCombinationIter<'w, 's, Q, QF, F, K> where
QF: Fetch<'w, 's, State = Q::State> + Clone + ReadOnlyFetch,
F::Fetch: Clone + FilterFetch + ReadOnlyFetch, type Item = [QF::Item; K];
Returns an Iterator
over all possible combinations of K
query results without repetition.
This can only be called for read-only queries.
For permutations of size K of query returning N results, you will get:
- if K == N: one permutation of all query results
- if K < N: all possible K-sized combinations of query results, without repetition
- if K > N: empty set (no K-sized combinations exist)
This can only be called for read-only queries, see Self::iter_combinations_mut
for
write-queries.
pub fn iter_combinations_mut<'w, 's, const K: usize>(
&'s mut self,
world: &'w mut World
) -> QueryCombinationIter<'w, 's, Q, Q::Fetch, F, K>ⓘNotable traits for QueryCombinationIter<'w, 's, Q, QF, F, K>impl<'w, 's, Q: WorldQuery, QF, F: WorldQuery, const K: usize> Iterator for QueryCombinationIter<'w, 's, Q, QF, F, K> where
QF: Fetch<'w, 's, State = Q::State> + Clone + ReadOnlyFetch,
F::Fetch: Clone + FilterFetch + ReadOnlyFetch, type Item = [QF::Item; K];
pub fn iter_combinations_mut<'w, 's, const K: usize>(
&'s mut self,
world: &'w mut World
) -> QueryCombinationIter<'w, 's, Q, Q::Fetch, F, K>ⓘNotable traits for QueryCombinationIter<'w, 's, Q, QF, F, K>impl<'w, 's, Q: WorldQuery, QF, F: WorldQuery, const K: usize> Iterator for QueryCombinationIter<'w, 's, Q, QF, F, K> where
QF: Fetch<'w, 's, State = Q::State> + Clone + ReadOnlyFetch,
F::Fetch: Clone + FilterFetch + ReadOnlyFetch, type Item = [QF::Item; K];
impl<'w, 's, Q: WorldQuery, QF, F: WorldQuery, const K: usize> Iterator for QueryCombinationIter<'w, 's, Q, QF, F, K> where
QF: Fetch<'w, 's, State = Q::State> + Clone + ReadOnlyFetch,
F::Fetch: Clone + FilterFetch + ReadOnlyFetch, type Item = [QF::Item; K];
Iterates over all possible combinations of K
query results for the given World
without repetition.
For permutations of size K of query returning N results, you will get:
- if K == N: one permutation of all query results
- if K < N: all possible K-sized combinations of query results, without repetition
- if K > N: empty set (no K-sized combinations exist)
pub unsafe fn iter_unchecked<'w, 's>(
&'s mut self,
world: &'w World
) -> QueryIter<'w, 's, Q, Q::Fetch, F>ⓘNotable traits for QueryIter<'w, 's, Q, QF, F>impl<'w, 's, Q: WorldQuery, QF, F: WorldQuery> Iterator for QueryIter<'w, 's, Q, QF, F> where
F::Fetch: FilterFetch,
QF: Fetch<'w, 's, State = Q::State>, type Item = QF::Item;
pub unsafe fn iter_unchecked<'w, 's>(
&'s mut self,
world: &'w World
) -> QueryIter<'w, 's, Q, Q::Fetch, F>ⓘNotable traits for QueryIter<'w, 's, Q, QF, F>impl<'w, 's, Q: WorldQuery, QF, F: WorldQuery> Iterator for QueryIter<'w, 's, Q, QF, F> where
F::Fetch: FilterFetch,
QF: Fetch<'w, 's, State = Q::State>, type Item = QF::Item;
impl<'w, 's, Q: WorldQuery, QF, F: WorldQuery> Iterator for QueryIter<'w, 's, Q, QF, F> where
F::Fetch: FilterFetch,
QF: Fetch<'w, 's, State = Q::State>, type Item = QF::Item;
pub unsafe fn iter_combinations_unchecked<'w, 's, const K: usize>(
&'s mut self,
world: &'w World
) -> QueryCombinationIter<'w, 's, Q, Q::Fetch, F, K>ⓘNotable traits for QueryCombinationIter<'w, 's, Q, QF, F, K>impl<'w, 's, Q: WorldQuery, QF, F: WorldQuery, const K: usize> Iterator for QueryCombinationIter<'w, 's, Q, QF, F, K> where
QF: Fetch<'w, 's, State = Q::State> + Clone + ReadOnlyFetch,
F::Fetch: Clone + FilterFetch + ReadOnlyFetch, type Item = [QF::Item; K];
pub unsafe fn iter_combinations_unchecked<'w, 's, const K: usize>(
&'s mut self,
world: &'w World
) -> QueryCombinationIter<'w, 's, Q, Q::Fetch, F, K>ⓘNotable traits for QueryCombinationIter<'w, 's, Q, QF, F, K>impl<'w, 's, Q: WorldQuery, QF, F: WorldQuery, const K: usize> Iterator for QueryCombinationIter<'w, 's, Q, QF, F, K> where
QF: Fetch<'w, 's, State = Q::State> + Clone + ReadOnlyFetch,
F::Fetch: Clone + FilterFetch + ReadOnlyFetch, type Item = [QF::Item; K];
impl<'w, 's, Q: WorldQuery, QF, F: WorldQuery, const K: usize> Iterator for QueryCombinationIter<'w, 's, Q, QF, F, K> where
QF: Fetch<'w, 's, State = Q::State> + Clone + ReadOnlyFetch,
F::Fetch: Clone + FilterFetch + ReadOnlyFetch, type Item = [QF::Item; K];
Returns an Iterator
over all possible combinations of K
query results for the
given World
without repetition.
This can only be called for read-only queries.
Safety
This does not check for mutable query correctness. To be safe, make sure mutable queries have unique access to the components they query.
Runs func
on each query result for the given World
. This is faster than the equivalent
iter() method, but cannot be chained like a normal Iterator
.
This can only be called for read-only queries, see Self::for_each_mut
for write-queries.
Runs func
on each query result for the given World
. This is faster than the equivalent
iter() method, but cannot be chained like a normal Iterator
.
This can only be called for read-only queries.
Safety
This does not check for mutable query correctness. To be safe, make sure mutable queries have unique access to the components they query.
Runs func
on each query result in parallel using the given task_pool
.
This can only be called for read-only queries, see Self::par_for_each_mut
for
write-queries.
Runs func
on each query result in parallel using the given task_pool
.
Runs func
on each query result in parallel using the given task_pool
.
This can only be called for read-only queries.
Safety
This does not check for mutable query correctness. To be safe, make sure mutable queries have unique access to the components they query.
Trait Implementations
impl<'w, 's, Q: WorldQuery + 'static, F: WorldQuery + 'static> SystemParamFetch<'w, 's> for QueryState<Q, F> where
F::Fetch: FilterFetch,
impl<'w, 's, Q: WorldQuery + 'static, F: WorldQuery + 'static> SystemParamFetch<'w, 's> for QueryState<Q, F> where
F::Fetch: FilterFetch,
impl<Q: WorldQuery + 'static, F: WorldQuery + 'static> SystemParamState for QueryState<Q, F> where
F::Fetch: FilterFetch,
impl<Q: WorldQuery + 'static, F: WorldQuery + 'static> SystemParamState for QueryState<Q, F> where
F::Fetch: FilterFetch,
Values of this type can be used to adjust the behavior of the
system parameter. For instance, this can be used to pass
values from a Plugin
to a System
, or to control the
behavior of the System
. Read more
impl<Q: WorldQuery, F: WorldQuery> ReadOnlySystemParamFetch for QueryState<Q, F> where
Q::Fetch: ReadOnlyFetch,
F::Fetch: FilterFetch,
Auto Trait Implementations
impl<Q, F> RefUnwindSafe for QueryState<Q, F> where
<F as WorldQuery>::State: RefUnwindSafe,
<Q as WorldQuery>::State: RefUnwindSafe,
impl<Q, F> Send for QueryState<Q, F>
impl<Q, F> Sync for QueryState<Q, F>
impl<Q, F> Unpin for QueryState<Q, F> where
<F as WorldQuery>::State: Unpin,
<Q as WorldQuery>::State: Unpin,
impl<Q, F> UnwindSafe for QueryState<Q, F> where
<F as WorldQuery>::State: UnwindSafe,
<Q as WorldQuery>::State: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more