pub struct DynQuery<'world, Q: QueryTuple> {
pub world: &'world mut DynWorld,
pub include: u64,
pub exclude: u64,
pub changed_mask: u64,
pub added_mask: u64,
pub include_tag_sets: [Option<&'world SparseTagSet>; 4],
pub exclude_tag_sets: [Option<&'world SparseTagSet>; 4],
pub element_masks: Option<[u64; 8]>,
pub marker: PhantomData<Q>,
}Expand description
A typed query in progress. Filters compose before for_each runs it.
Like everything else in the crate, the fields are plain data: the filter
methods are conveniences over them, and writing them directly is fine.
DynWorld::query seeds include with the tuple’s required components;
a hand-built query whose include misses one panics at fetch rather than
misbehaving.
Fields§
§world: &'world mut DynWorld§include: u64§exclude: u64§changed_mask: u64§added_mask: u64§include_tag_sets: [Option<&'world SparseTagSet>; 4]§exclude_tag_sets: [Option<&'world SparseTagSet>; 4]§element_masks: Option<[u64; 8]>§marker: PhantomData<Q>Implementations§
Source§impl<'world, Q: QueryTuple> DynQuery<'world, Q>
impl<'world, Q: QueryTuple> DynQuery<'world, Q>
pub fn with<T: Send + Sync + Default + 'static>(self) -> Self
pub fn without<T: Send + Sync + Default + 'static>(self) -> Self
pub fn with_mask(self, mask: u64) -> Self
pub fn without_mask(self, mask: u64) -> Self
pub fn with_tag(self, key: TagKey) -> Self
pub fn without_tag(self, key: TagKey) -> Self
Sourcepub fn with_tag_type<T: 'static>(self) -> Self
pub fn with_tag_type<T: 'static>(self) -> Self
Filter by the marker type T’s tag, registering it on first use.
Registration permanently consumes one of the world’s 64 mask bits,
even when nothing carries the tag yet; on a shared borrow,
DynQueryRef::with_tag_type looks up without registering.
pub fn without_tag_type<T: 'static>(self) -> Self
Sourcepub fn with_tag_set(self, tag_set: &'world SparseTagSet) -> Self
pub fn with_tag_set(self, tag_set: &'world SparseTagSet) -> Self
Filter by membership in an external tag set, the grouped-worlds form:
DynEcs tags live outside any single world’s mask space, so they
filter by set reference instead of by mask bit.
pub fn without_tag_set(self, tag_set: &'world SparseTagSet) -> Self
Sourcepub fn changed<T: Send + Sync + Default + 'static>(self) -> Self
pub fn changed<T: Send + Sync + Default + 'static>(self) -> Self
Only visit entities whose T changed since the last step. T must be
one of the tuple’s components.
Sourcepub fn added<T: Send + Sync + Default + 'static>(self) -> Self
pub fn added<T: Send + Sync + Default + 'static>(self) -> Self
Only visit entities that gained T since the last step, whether by
spawn or by a component add; mutating T does not retrigger this, and
the added stamp rides along through table migrations. T must be one
of the tuple’s components.
Sourcepub fn prepare(self) -> PreparedQuery<Q>
pub fn prepare(self) -> PreparedQuery<Q>
Freezes this query’s resolved masks into a reusable
PreparedQuery, registering the tuple’s types now. Tag-set
references cannot be captured (they borrow the world); apply those
at run time on the rehydrated query.
pub fn for_each(self, f: impl for<'item> FnMut(Entity, Q::Item<'item>))
Sourcepub fn par_for_each<F>(self, f: F)
pub fn par_for_each<F>(self, f: F)
The parallel form of for_each: matching tables
run concurrently while rows within a table stay sequential, so
parallelism is table-granular like DynWorld::par_for_each_mut.
Same filter set and stamping semantics; the closure is Fn because
tables run on worker threads, and the added filter builds one
scratch buffer per table task.
Auto Trait Implementations§
impl<'world, Q> !RefUnwindSafe for DynQuery<'world, Q>
impl<'world, Q> !UnwindSafe for DynQuery<'world, Q>
impl<'world, Q> Freeze for DynQuery<'world, Q>
impl<'world, Q> Send for DynQuery<'world, Q>where
Q: Send,
impl<'world, Q> Sync for DynQuery<'world, Q>where
Q: Sync,
impl<'world, Q> Unpin for DynQuery<'world, Q>where
Q: Unpin,
impl<'world, Q> UnsafeUnpin for DynQuery<'world, Q>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more