Struct bevy_ecs::system::Query[][src]

pub struct Query<'w, Q: WorldQuery, F: WorldQuery = ()> where
    F::Fetch: FilterFetch
{ /* fields omitted */ }

Provides scoped access to a World according to a given WorldQuery and query filter

Implementations

impl<'w, Q: WorldQuery, F: WorldQuery> Query<'w, Q, F> where
    F::Fetch: FilterFetch
[src]

pub fn iter(&self) -> QueryIter<'_, '_, Q, F>

Notable traits for QueryIter<'w, 's, Q, F>

impl<'w, 's, Q: WorldQuery, F: WorldQuery> Iterator for QueryIter<'w, 's, Q, F> where
    F::Fetch: FilterFetch
type Item = <Q::Fetch as Fetch<'w>>::Item;
where
    Q::Fetch: ReadOnlyFetch
[src]

Iterates over the query results. This can only be called for read-only queries

pub fn iter_mut(&mut self) -> QueryIter<'_, '_, Q, F>

Notable traits for QueryIter<'w, 's, Q, F>

impl<'w, 's, Q: WorldQuery, F: WorldQuery> Iterator for QueryIter<'w, 's, Q, F> where
    F::Fetch: FilterFetch
type Item = <Q::Fetch as Fetch<'w>>::Item;
[src]

Iterates over the query results

pub unsafe fn iter_unsafe(&self) -> QueryIter<'_, '_, Q, F>

Notable traits for QueryIter<'w, 's, Q, F>

impl<'w, 's, Q: WorldQuery, F: WorldQuery> Iterator for QueryIter<'w, 's, Q, F> where
    F::Fetch: FilterFetch
type Item = <Q::Fetch as Fetch<'w>>::Item;
[src]

Iterates over the query results

Safety

This allows aliased mutability. You must make sure this call does not result in multiple mutable references to the same component

pub fn for_each(&self, f: impl FnMut(<Q::Fetch as Fetch<'w>>::Item)) where
    Q::Fetch: ReadOnlyFetch
[src]

Runs f on each query result. 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

pub fn for_each_mut(&self, f: impl FnMut(<Q::Fetch as Fetch<'w>>::Item))[src]

Runs f on each query result. This is faster than the equivalent iter() method, but cannot be chained like a normal iterator.

pub fn par_for_each(
    &self,
    task_pool: &TaskPool,
    batch_size: usize,
    f: impl Fn(<Q::Fetch as Fetch<'w>>::Item) + Send + Sync + Clone
) where
    Q::Fetch: ReadOnlyFetch
[src]

Runs f on each query result in parallel using the given task pool.

pub fn par_for_each_mut(
    &mut self,
    task_pool: &TaskPool,
    batch_size: usize,
    f: impl Fn(<Q::Fetch as Fetch<'w>>::Item) + Send + Sync + Clone
)
[src]

Runs f on each query result in parallel using the given task pool.

pub fn get(
    &self,
    entity: Entity
) -> Result<<Q::Fetch as Fetch<'_>>::Item, QueryEntityError> where
    Q::Fetch: ReadOnlyFetch
[src]

Gets the query result for the given entity

pub fn get_mut(
    &mut self,
    entity: Entity
) -> Result<<Q::Fetch as Fetch<'_>>::Item, QueryEntityError>
[src]

Gets the query result for the given entity

pub unsafe fn get_unchecked(
    &self,
    entity: Entity
) -> Result<<Q::Fetch as Fetch<'_>>::Item, QueryEntityError>
[src]

Gets the query result for the given entity

Safety

This allows aliased mutability. You must make sure this call does not result in multiple mutable references to the same component

pub fn get_component<T: Component>(
    &self,
    entity: Entity
) -> Result<&T, QueryComponentError>
[src]

Gets a reference to the entity’s component of the given type. This will fail if the entity does not have the given component type or if the given component type does not match this query.

pub fn get_component_mut<T: Component>(
    &mut self,
    entity: Entity
) -> Result<Mut<'_, T>, QueryComponentError>
[src]

Gets a mutable reference to the entity’s component of the given type. This will fail if the entity does not have the given component type or if the given component type does not match this query.

pub unsafe fn get_component_unchecked_mut<T: Component>(
    &self,
    entity: Entity
) -> Result<Mut<'_, T>, QueryComponentError>
[src]

Gets a mutable reference to the entity’s component of the given type. This will fail if the entity does not have the given component type or the component does not match the query.

Safety

This allows aliased mutability. You must make sure this call does not result in multiple mutable references to the same component

pub fn single(&self) -> Result<<Q::Fetch as Fetch<'_>>::Item, QuerySingleError> where
    Q::Fetch: ReadOnlyFetch
[src]

pub fn single_mut(
    &mut self
) -> Result<<Q::Fetch as Fetch<'_>>::Item, QuerySingleError>
[src]

Trait Implementations

impl<'a, Q: WorldQuery + 'static, F: WorldQuery + 'static> SystemParam for Query<'a, Q, F> where
    F::Fetch: FilterFetch
[src]

type Fetch = QueryState<Q, F>

Auto Trait Implementations

impl<'w, Q, F = ()> !RefUnwindSafe for Query<'w, Q, F>

impl<'w, Q, F> Send for Query<'w, Q, F>

impl<'w, Q, F> Sync for Query<'w, Q, F>

impl<'w, Q, F> Unpin for Query<'w, Q, F>

impl<'w, Q, F = ()> !UnwindSafe for Query<'w, Q, F>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Component for T where
    T: 'static + Send + Sync
[src]

impl<T> Downcast for T where
    T: Any
[src]

impl<T> DowncastSync for T where
    T: Any + Send + Sync
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,