Skip to main content

DynQuery

Struct DynQuery 

Source
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>

Source

pub fn with<T: Send + Sync + Default + 'static>(self) -> Self

Source

pub fn without<T: Send + Sync + Default + 'static>(self) -> Self

Source

pub fn with_mask(self, mask: u64) -> Self

Source

pub fn without_mask(self, mask: u64) -> Self

Source

pub fn with_tag(self, key: TagKey) -> Self

Source

pub fn without_tag(self, key: TagKey) -> Self

Source

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.

Source

pub fn without_tag_type<T: 'static>(self) -> Self

Source

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.

Source

pub fn without_tag_set(self, tag_set: &'world SparseTagSet) -> Self

Source

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.

Source

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.

Source

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.

Source

pub fn for_each(self, f: impl for<'item> FnMut(Entity, Q::Item<'item>))

Source

pub fn par_for_each<F>(self, f: F)
where F: for<'item> Fn(Entity, Q::Item<'item>) + Send + Sync,

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.