Struct legion::Query[][src]

pub struct Query<V: IntoView, F: EntityFilter = <<V as IntoView>::View as DefaultFilter>::Filter> { /* fields omitted */ }
Expand description

Provides efficient means to iterate and filter entities in a world.

See the module-level documentation for more details and examples.

Implementations

Consructs a new Query

Adds an additional filter to the query.

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.

Returns the components for a single entity.

Returns the components for a single entity.

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.

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.

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.

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.

Returns an iterator which will yield all components which match the query.

Prefer for_each_mut as it yields better performance.

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.

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.

Iterates through all entity chunks which match the query.

Each chunk contains slices of components for entities which all have the same component layout.

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.

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.

Iterates through all components which match the query.

Iterates through all components which match the query.

Only usable with queries whose views are read-only.

Trait Implementations

Returns the “default value” for a type. Read more

Evaluates the queries and records which archetypes they require access to into a bitset.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait. Read more

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s. Read more

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.