[−][src]Struct bevy_ecs::Query
Provides scoped access to a World according to a given [HecsQuery]
Implementations
impl<'a, Q: WorldQuery, F: QueryFilter> Query<'a, Q, F>
[src]
pub fn iter(&self) -> QueryIter<'_, Q, F>ⓘNotable traits for QueryIter<'w, Q, F>
impl<'w, Q: WorldQuery, F: QueryFilter> Iterator for QueryIter<'w, Q, F> type Item = <Q::Fetch as Fetch<'w>>::Item;
where
Q::Fetch: ReadOnlyFetch,
[src]
Notable traits for QueryIter<'w, Q, F>
impl<'w, Q: WorldQuery, F: QueryFilter> Iterator for QueryIter<'w, Q, F> 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, Q, F>
impl<'w, Q: WorldQuery, F: QueryFilter> Iterator for QueryIter<'w, Q, F> type Item = <Q::Fetch as Fetch<'w>>::Item;
[src]
Notable traits for QueryIter<'w, Q, F>
impl<'w, Q: WorldQuery, F: QueryFilter> Iterator for QueryIter<'w, Q, F> 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, Q, F>
impl<'w, Q: WorldQuery, F: QueryFilter> Iterator for QueryIter<'w, Q, F> type Item = <Q::Fetch as Fetch<'w>>::Item;
[src]
Notable traits for QueryIter<'w, Q, F>
impl<'w, Q: WorldQuery, F: QueryFilter> Iterator for QueryIter<'w, Q, F> 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 par_iter(&self, batch_size: usize) -> ParIter<'_, Q, F> where
Q::Fetch: ReadOnlyFetch,
[src]
Q::Fetch: ReadOnlyFetch,
pub fn par_iter_mut(&mut self, batch_size: usize) -> ParIter<'_, Q, F>
[src]
pub fn get(
&self,
entity: Entity
) -> Result<<Q::Fetch as Fetch<'_>>::Item, QueryError> where
Q::Fetch: ReadOnlyFetch,
[src]
&self,
entity: Entity
) -> Result<<Q::Fetch as Fetch<'_>>::Item, QueryError> 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, QueryError>
[src]
&mut self,
entity: Entity
) -> Result<<Q::Fetch as Fetch<'_>>::Item, QueryError>
Gets the query result for the given entity
pub unsafe fn get_unsafe(
&self,
entity: Entity
) -> Result<<Q::Fetch as Fetch<'_>>::Item, QueryError>
[src]
&self,
entity: Entity
) -> Result<<Q::Fetch as Fetch<'_>>::Item, QueryError>
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, QueryError>
[src]
&self,
entity: Entity
) -> Result<&T, QueryError>
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>, QueryError>
[src]
&mut self,
entity: Entity
) -> Result<Mut<'_, T>, QueryError>
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_unsafe<T: Component>(
&self,
entity: Entity
) -> Result<Mut<'_, T>, QueryError>
[src]
&self,
entity: Entity
) -> Result<Mut<'_, T>, QueryError>
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: Component>(&self) -> &[Entity]
[src]
Returns an array containing the Entity
s in this Query
that had the given Component
removed in this update.
removed::<C>()
only returns entities whose components were removed before the
current system started.
Regular systems do not apply Commands
until the end of their stage. This means component
removals in a regular system won't be accessible through removed::<C>()
in the same
stage, because the removal hasn't actually occurred yet. This can be solved by executing
removed::<C>()
in a later stage. AppBuilder::add_system_to_stage()
can be used to
control at what stage a system runs.
Thread local systems manipulate the world directly, so removes are applied immediately. This means any system that runs after a thread local system in the same update will pick up removals that happened in the thread local system, regardless of stages.
pub fn set<T: Component>(
&mut self,
entity: Entity,
component: T
) -> Result<(), QueryError>
[src]
&mut self,
entity: Entity,
component: T
) -> Result<(), QueryError>
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 + WorldQuery, F: Debug + QueryFilter> Debug for Query<'a, Q, F>
[src]
impl<'a, Q: WorldQuery, F: QueryFilter> SystemParam for Query<'a, Q, F>
[src]
type Fetch = FetchQuery<Q, F>
Auto Trait Implementations
impl<'a, Q, F = ()> !RefUnwindSafe for Query<'a, Q, F>
[src]
impl<'a, Q, F> Send for Query<'a, Q, F> where
F: Send,
Q: Send,
[src]
F: Send,
Q: Send,
impl<'a, Q, F> Sync for Query<'a, Q, F> where
F: Sync,
Q: Sync,
[src]
F: Sync,
Q: Sync,
impl<'a, Q, F> Unpin for Query<'a, Q, F> where
F: Unpin,
Q: Unpin,
[src]
F: Unpin,
Q: Unpin,
impl<'a, Q, F = ()> !UnwindSafe for Query<'a, Q, F>
[src]
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> 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: Send + Sync + Any,
[src]
T: Send + Sync + Any,
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>,