[][src]Struct bevy::ecs::prelude::Query

pub struct Query<'a, Q> where
    Q: Query
{ /* fields omitted */ }

Provides scoped access to a World according to a given HecsQuery

Implementations

impl<'a, Q> Query<'a, Q> where
    Q: Query
[src]

pub fn new(
    world: &'a World,
    component_access: &'a TypeAccess<ArchetypeComponent>
) -> Query<'a, Q>
[src]

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

Notable traits for QueryIter<'w, Q>

impl<'w, Q> Iterator for QueryIter<'w, Q> where
    Q: Query
type Item = <<Q as Query>::Fetch as Fetch<'w>>::Item;
where
    <Q as Query>::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>

Notable traits for QueryIter<'w, Q>

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

Iterates over the query results

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

Notable traits for QueryIter<'w, Q>

impl<'w, Q> Iterator for QueryIter<'w, Q> where
    Q: Query
type Item = <<Q as Query>::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 par_iter(&self, batch_size: usize) -> ParIter<'_, Q> where
    <Q as Query>::Fetch: ReadOnlyFetch
[src]

pub fn par_iter_mut(&mut self, batch_size: usize) -> ParIter<'_, Q>[src]

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

Gets the query result for the given entity

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

Gets the query result for the given entity

pub unsafe fn entity_unsafe(
    &self,
    entity: Entity
) -> Result<<<Q as Query>::Fetch as Fetch<'_>>::Item, QueryError>
[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>(&self, entity: Entity) -> Result<&T, QueryError> where
    T: Component
[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>(
    &mut self,
    entity: Entity
) -> Result<Mut<'_, T>, QueryError> where
    T: Component
[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_unsafe<T>(
    &self,
    entity: Entity
) -> Result<Mut<'_, T>, QueryError> where
    T: Component
[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

Safety

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

pub fn removed<C>(&self) -> &[Entity]

Notable traits for &'_ mut [u8]

impl<'_> Write for &'_ mut [u8]impl<'_> Read for &'_ [u8]
where
    C: Component
[src]

pub fn set<T>(&mut self, entity: Entity, component: T) -> Result<(), QueryError> where
    T: Component
[src]

Sets the entity's component to the given value. This will fail if the entity does not already have the given component type or if the given component type does not match this query.

Trait Implementations

impl<'a, Q> Debug for Query<'a, Q> where
    Q: Debug + Query
[src]

Auto Trait Implementations

impl<'a, Q> !RefUnwindSafe for Query<'a, Q>

impl<'a, Q> Send for Query<'a, Q> where
    Q: Send

impl<'a, Q> Sync for Query<'a, Q> where
    Q: Sync

impl<'a, Q> Unpin for Query<'a, Q> where
    Q: Unpin

impl<'a, Q> !UnwindSafe for Query<'a, Q>

Blanket Implementations

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

impl<T> Any for T where
    T: Any

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

impl<T> Downcast for T where
    T: Any

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

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> Resource for T where
    T: 'static + Send + Sync
[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>,