Struct bevy_ecs::system::Query [−][src]
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]
F::Fetch: FilterFetch,
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]
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;
Q::Fetch: ReadOnlyFetch,
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]
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;
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]
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;
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]
Q::Fetch: ReadOnlyFetch,
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]
&self,
task_pool: &TaskPool,
batch_size: usize,
f: impl Fn(<Q::Fetch as Fetch<'w>>::Item) + Send + Sync + Clone
) where
Q::Fetch: ReadOnlyFetch,
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]
&mut self,
task_pool: &TaskPool,
batch_size: usize,
f: impl Fn(<Q::Fetch as Fetch<'w>>::Item) + Send + Sync + Clone
)
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]
&self,
entity: Entity
) -> Result<<Q::Fetch as Fetch<'_>>::Item, QueryEntityError> where
Q::Fetch: ReadOnlyFetch,
Gets the query result for the given entity
pub fn get_mut(
&mut self,
entity: Entity
) -> Result<<Q::Fetch as Fetch<'_>>::Item, QueryEntityError>
[src]
&mut self,
entity: Entity
) -> Result<<Q::Fetch as Fetch<'_>>::Item, QueryEntityError>
Gets the query result for the given entity
pub unsafe fn get_unchecked(
&self,
entity: Entity
) -> Result<<Q::Fetch as Fetch<'_>>::Item, QueryEntityError>
[src]
&self,
entity: Entity
) -> Result<<Q::Fetch as Fetch<'_>>::Item, QueryEntityError>
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]
&self,
entity: Entity
) -> Result<&T, QueryComponentError>
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]
&mut self,
entity: Entity
) -> Result<Mut<'_, T>, QueryComponentError>
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]
&self,
entity: Entity
) -> Result<Mut<'_, T>, QueryComponentError>
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]
Q::Fetch: ReadOnlyFetch,
pub fn single_mut(
&mut self
) -> Result<<Q::Fetch as Fetch<'_>>::Item, QuerySingleError>
[src]
&mut self
) -> Result<<Q::Fetch as Fetch<'_>>::Item, QuerySingleError>
See Query::single
Trait Implementations
impl<'a, Q: WorldQuery + 'static, F: WorldQuery + 'static> SystemParam for Query<'a, Q, F> where
F::Fetch: FilterFetch,
[src]
F::Fetch: FilterFetch,
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Component for T where
T: 'static + Send + Sync,
[src]
T: 'static + Send + Sync,
impl<T> Downcast for T where
T: Any,
[src]
T: Any,
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
[src]
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
[src]
pub fn as_any(&self) -> &(dyn Any + 'static)
[src]
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
[src]
impl<T> DowncastSync for T where
T: Any + Send + Sync,
[src]
T: Any + Send + Sync,
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,