Struct legion::Query [−][src]
Provides efficient means to iterate and filter entities in a world.
See the module-level documentation for more details and examples.
Implementations
impl<V: IntoView, F: EntityFilter> Query<V, F>
[src]
pub fn new() -> Self
[src]
Consructs a new Query
pub fn filter<T: EntityFilter>(
self,
filter: T
) -> Query<V, <F as BitAnd<T>>::Output> where
F: BitAnd<T>,
<F as BitAnd<T>>::Output: EntityFilter,
[src]
self,
filter: T
) -> Query<V, <F as BitAnd<T>>::Output> where
F: BitAnd<T>,
<F as BitAnd<T>>::Output: EntityFilter,
Adds an additional filter to the query.
pub unsafe fn get_unchecked<'query, 'world, T>(
&'query mut self,
world: &'world T,
entity: Entity
) -> Result<<V::View as View<'world>>::Element, EntityAccessError> where
T: EntityStore,
[src]
&'query mut self,
world: &'world T,
entity: Entity
) -> Result<<V::View as View<'world>>::Element, EntityAccessError> where
T: EntityStore,
Returns the components for a single entity.
This function will not evaluate the query’s dynamic filters. This means, for example, that
calling get
on all entities in an archetype will not prevent maybe_changed
from returning
those entities the next time the query is iterated.
Safety
This function allows mutable access via a shared world reference. The caller is responsible for ensuring that no component accesses may create mutable aliases.
pub fn get_mut<'query, 'world, T>(
&'query mut self,
world: &'world mut T,
entity: Entity
) -> Result<<V::View as View<'world>>::Element, EntityAccessError> where
T: EntityStore,
[src]
&'query mut self,
world: &'world mut T,
entity: Entity
) -> Result<<V::View as View<'world>>::Element, EntityAccessError> where
T: EntityStore,
Returns the components for a single entity.
pub fn get<'query, 'world, T>(
&'query mut self,
world: &'world T,
entity: Entity
) -> Result<<V::View as View<'world>>::Element, EntityAccessError> where
T: EntityStore,
<V::View as View<'world>>::Fetch: ReadOnlyFetch,
[src]
&'query mut self,
world: &'world T,
entity: Entity
) -> Result<<V::View as View<'world>>::Element, EntityAccessError> where
T: EntityStore,
<V::View as View<'world>>::Fetch: ReadOnlyFetch,
Returns the components for a single entity.
pub unsafe fn iter_chunks_unchecked<'query, 'world, T: EntityStore>(
&'query mut self,
world: &'world T
) -> ChunkIter<'world, 'query, V::View, F>ⓘ
[src]
&'query mut self,
world: &'world T
) -> ChunkIter<'world, 'query, V::View, F>ⓘ
Returns an iterator which will yield all entity chunks which match the query.
Each chunk contains slices of components for entities which all have the same component layout.
Safety
This function allows mutable access via a shared world reference. The caller is responsible for ensuring that no component accesses may create mutable aliases.
pub unsafe fn par_iter_chunks_unchecked<'a, T: EntityStore>(
&'a mut self,
world: &'a T
) -> ParChunkIter<'a, V::View, F>
[src]
&'a mut self,
world: &'a T
) -> ParChunkIter<'a, V::View, F>
Returns a parallel iterator which will yield all entity chunks which match the query.
Each chunk contains slices of components for entities which all have the same component layout.
Safety
This function allows mutable access via a shared world reference. The caller is responsible for ensuring that no component accesses may create mutable aliases.
pub fn iter_chunks_mut<'query, 'world, T: EntityStore>(
&'query mut self,
world: &'world mut T
) -> ChunkIter<'world, 'query, V::View, F>ⓘ
[src]
&'query mut self,
world: &'world mut T
) -> ChunkIter<'world, 'query, V::View, F>ⓘ
Returns an iterator which will yield all entity chunks which match the query.
Each chunk contains slices of components for entities which all have the same component layout.
pub fn par_iter_chunks_mut<'a, T: EntityStore>(
&'a mut self,
world: &'a mut T
) -> ParChunkIter<'a, V::View, F>
[src]
&'a mut self,
world: &'a mut T
) -> ParChunkIter<'a, V::View, F>
Returns a parallel iterator which will yield all entity chunks which match the query.
Each chunk contains slices of components for entities which all have the same component layout.
pub fn iter_chunks<'query, 'world, T: EntityStore>(
&'query mut self,
world: &'world T
) -> ChunkIter<'world, 'query, V::View, F>ⓘ where
<V::View as View<'world>>::Fetch: ReadOnlyFetch,
[src]
&'query mut self,
world: &'world T
) -> ChunkIter<'world, 'query, V::View, F>ⓘ where
<V::View as View<'world>>::Fetch: ReadOnlyFetch,
Returns an iterator which will yield all entity chunks which match the query.
Each chunk contains slices of components for entities which all have the same component layout.
Only usable with queries whose views are read-only.
pub fn par_iter_chunks<'a, T: EntityStore>(
&'a mut self,
world: &'a T
) -> ParChunkIter<'a, V::View, F> where
<V::View as View<'a>>::Fetch: ReadOnlyFetch,
[src]
&'a mut self,
world: &'a T
) -> ParChunkIter<'a, V::View, F> where
<V::View as View<'a>>::Fetch: ReadOnlyFetch,
Returns a parallel iterator which will yield all entity chunks which match the query.
Each chunk contains slices of components for entities which all have the same component layout. Only usable with queries whose views are read-only.
pub unsafe fn iter_unchecked<'query, 'world, T: EntityStore>(
&'query mut self,
world: &'world T
) -> Flatten<ChunkIter<'world, 'query, V::View, F>>
[src]
&'query mut self,
world: &'world T
) -> Flatten<ChunkIter<'world, 'query, V::View, F>>
Returns an iterator which will yield all components which match the query.
Prefer for_each_unchecked
as it offers better performance.
Safety
This function allows mutable access via a shared world reference. The caller is responsible for ensuring that no component accesses may create mutable aliases.
pub unsafe fn par_iter_unchecked<'a, T: EntityStore>(
&'a mut self,
world: &'a T
) -> Flatten<ParChunkIter<'a, V::View, F>>
[src]
&'a mut self,
world: &'a T
) -> Flatten<ParChunkIter<'a, V::View, F>>
Returns a parallel iterator which will yield all components which match the query.
Safety
This function allows mutable access via a shared world reference. The caller is responsible for ensuring that no component accesses may create mutable aliases.
pub fn iter_mut<'query, 'world, T: EntityStore>(
&'query mut self,
world: &'world mut T
) -> Flatten<ChunkIter<'world, 'query, V::View, F>>
[src]
&'query mut self,
world: &'world mut T
) -> Flatten<ChunkIter<'world, 'query, V::View, F>>
Returns an iterator which will yield all components which match the query.
Prefer for_each_mut
as it yields better performance.
pub fn par_iter_mut<'a, T: EntityStore>(
&'a mut self,
world: &'a mut T
) -> Flatten<ParChunkIter<'a, V::View, F>>
[src]
&'a mut self,
world: &'a mut T
) -> Flatten<ParChunkIter<'a, V::View, F>>
Returns a parallel iterator which will yield all components which match the query.
pub fn iter<'query, 'world, T: EntityStore>(
&'query mut self,
world: &'world T
) -> Flatten<ChunkIter<'world, 'query, V::View, F>> where
<V::View as View<'world>>::Fetch: ReadOnlyFetch,
[src]
&'query mut self,
world: &'world T
) -> Flatten<ChunkIter<'world, 'query, V::View, F>> where
<V::View as View<'world>>::Fetch: ReadOnlyFetch,
Returns an iterator which will yield all components which match the query.
Prefer for_each
as it yields better performance.
Only usable with queries whose views are read-only.
pub fn par_iter<'a, T: EntityStore>(
&'a mut self,
world: &'a T
) -> Flatten<ParChunkIter<'a, V::View, F>> where
<V::View as View<'a>>::Fetch: ReadOnlyFetch,
[src]
&'a mut self,
world: &'a T
) -> Flatten<ParChunkIter<'a, V::View, F>> where
<V::View as View<'a>>::Fetch: ReadOnlyFetch,
Returns a parallel iterator which will yield all components which match the query.
Only usable with queries whose views are read-only.
pub unsafe fn for_each_chunk_unchecked<'query, 'world, T: EntityStore, Body>(
&'query mut self,
world: &'world T,
f: Body
) where
Body: FnMut(ChunkView<'_, <V::View as View<'world>>::Fetch>),
[src]
&'query mut self,
world: &'world T,
f: Body
) where
Body: FnMut(ChunkView<'_, <V::View as View<'world>>::Fetch>),
Iterates through all entity chunks which match the query.
Each chunk contains slices of components for entities which all have the same component layout.
Safety
This function allows mutable access via a shared world reference. The caller is responsible for ensuring that no component accesses may create mutable aliases.
pub unsafe fn par_for_each_chunk_unchecked<'a, T: EntityStore, Body>(
&'a mut self,
world: &'a T,
f: Body
) where
Body: Fn(ChunkView<'_, <V::View as View<'a>>::Fetch>) + Send + Sync,
[src]
&'a mut self,
world: &'a T,
f: Body
) where
Body: Fn(ChunkView<'_, <V::View as View<'a>>::Fetch>) + Send + Sync,
Iterates in parallel through all entity chunks which match the query.
Each chunk contains slices of components for entities which all have the same component layout.
Safety
This function allows mutable access via a shared world reference. The caller is responsible for ensuring that no component accesses may create mutable aliases.
pub fn for_each_chunk_mut<'query, 'world, T: EntityStore, Body>(
&'query mut self,
world: &'world mut T,
f: Body
) where
Body: FnMut(ChunkView<'_, <V::View as View<'world>>::Fetch>),
[src]
&'query mut self,
world: &'world mut T,
f: Body
) where
Body: FnMut(ChunkView<'_, <V::View as View<'world>>::Fetch>),
Iterates through all entity chunks which match the query.
Each chunk contains slices of components for entities which all have the same component layout.
pub fn par_for_each_chunk_mut<'a, T: EntityStore, Body>(
&'a mut self,
world: &'a mut T,
f: Body
) where
Body: Fn(ChunkView<'_, <V::View as View<'a>>::Fetch>) + Send + Sync,
[src]
&'a mut self,
world: &'a mut T,
f: Body
) where
Body: Fn(ChunkView<'_, <V::View as View<'a>>::Fetch>) + Send + Sync,
Iterates in parallel through all entity chunks which match the query.
Each chunk contains slices of components for entities which all have the same component layout.
pub fn for_each_chunk<'query, 'world, T: EntityStore, Body>(
&'query mut self,
world: &'world T,
f: Body
) where
Body: FnMut(ChunkView<'_, <V::View as View<'world>>::Fetch>),
<V::View as View<'world>>::Fetch: ReadOnlyFetch,
[src]
&'query mut self,
world: &'world T,
f: Body
) where
Body: FnMut(ChunkView<'_, <V::View as View<'world>>::Fetch>),
<V::View as View<'world>>::Fetch: ReadOnlyFetch,
Iterates through all entity chunks which match the query.
Each chunk contains slices of components for entities which all have the same component layout.
Only usable with queries whose views are read-only.
pub fn par_for_each_chunk<'a, T: EntityStore, Body>(
&'a mut self,
world: &'a T,
f: Body
) where
Body: Fn(ChunkView<'_, <V::View as View<'a>>::Fetch>) + Send + Sync,
<V::View as View<'a>>::Fetch: ReadOnlyFetch,
[src]
&'a mut self,
world: &'a T,
f: Body
) where
Body: Fn(ChunkView<'_, <V::View as View<'a>>::Fetch>) + Send + Sync,
<V::View as View<'a>>::Fetch: ReadOnlyFetch,
Iterates in parallel through all entity chunks which match the query.
Each chunk contains slices of components for entities which all have the same component layout.
Only usable with queries whose views are read-only.
pub unsafe fn for_each_unchecked<'query, 'world, T: EntityStore, Body>(
&'query mut self,
world: &'world T,
f: Body
) where
Body: FnMut(<V::View as View<'world>>::Element),
[src]
&'query mut self,
world: &'world T,
f: Body
) where
Body: FnMut(<V::View as View<'world>>::Element),
Iterates through all components which match the query.
Safety
This function allows mutable access via a shared world reference. The caller is responsible for ensuring that no component accesses may create mutable aliases.
pub unsafe fn par_for_each_unchecked<'a, T: EntityStore, Body>(
&'a mut self,
world: &'a T,
f: Body
) where
Body: Fn(<V::View as View<'a>>::Element) + Send + Sync,
[src]
&'a mut self,
world: &'a T,
f: Body
) where
Body: Fn(<V::View as View<'a>>::Element) + Send + Sync,
Iterates in parallel through all components which match the query.
Safety
This function allows mutable access via a shared world reference. The caller is responsible for ensuring that no component accesses may create mutable aliases.
pub fn for_each_mut<'query, 'world, T: EntityStore, Body>(
&'query mut self,
world: &'world mut T,
f: Body
) where
Body: FnMut(<V::View as View<'world>>::Element),
[src]
&'query mut self,
world: &'world mut T,
f: Body
) where
Body: FnMut(<V::View as View<'world>>::Element),
Iterates through all components which match the query.
pub fn par_for_each_mut<'a, T: EntityStore, Body>(
&'a mut self,
world: &'a mut T,
f: Body
) where
Body: Fn(<V::View as View<'a>>::Element) + Send + Sync,
[src]
&'a mut self,
world: &'a mut T,
f: Body
) where
Body: Fn(<V::View as View<'a>>::Element) + Send + Sync,
Iterates in parallel through all components which match the query.
pub fn for_each<'query, 'world, T: EntityStore, Body>(
&'query mut self,
world: &'world T,
f: Body
) where
Body: FnMut(<V::View as View<'world>>::Element),
<V::View as View<'world>>::Fetch: ReadOnlyFetch,
[src]
&'query mut self,
world: &'world T,
f: Body
) where
Body: FnMut(<V::View as View<'world>>::Element),
<V::View as View<'world>>::Fetch: ReadOnlyFetch,
Iterates through all components which match the query.
Only usable with queries whose views are read-only.
pub fn par_for_each<'a, T: EntityStore, Body>(
&'a mut self,
world: &'a T,
f: Body
) where
Body: Fn(<V::View as View<'a>>::Element) + Send + Sync,
<V::View as View<'a>>::Fetch: ReadOnlyFetch,
[src]
&'a mut self,
world: &'a T,
f: Body
) where
Body: Fn(<V::View as View<'a>>::Element) + Send + Sync,
<V::View as View<'a>>::Fetch: ReadOnlyFetch,
Iterates in parallel through all components which match the query.
Only usable with queries whose views are read-only.
Trait Implementations
impl<V: IntoView, F: EntityFilter> Default for Query<V, F>
[src]
impl<AV, AF> QuerySet for Query<AV, AF> where
AV: IntoView + Send + Sync,
AF: EntityFilter,
[src]
AV: IntoView + Send + Sync,
AF: EntityFilter,
fn filter_archetypes(&mut self, world: &World, bitset: &mut BitSet)
[src]
Auto Trait Implementations
impl<V, F = <<V as IntoView>::View as DefaultFilter>::Filter> !RefUnwindSafe for Query<V, F>
impl<V, F> Send for Query<V, F> where
V: Send,
V: Send,
impl<V, F> Sync for Query<V, F> where
V: Sync,
V: Sync,
impl<V, F> Unpin for Query<V, F> where
F: Unpin,
V: Unpin,
F: Unpin,
V: Unpin,
impl<V, F> UnwindSafe for Query<V, F> where
F: UnwindSafe,
V: UnwindSafe,
F: UnwindSafe,
V: UnwindSafe,
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, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
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>,