Skip to main content

QUERY

Constant QUERY 

Source
pub const QUERY: FunctionDescriptor;
Expand description

Returns entity identities that have the selected type or implement the selected trait.

C means a concrete type or trait selector. The returned entity handles are ordered by creation and are a snapshot value; later lifecycle changes do not mutate the returned list.

§Signature

func query[C]() -> List[Entity]

§Query matching entities

The selector makes the query function value concrete.

type Counter {}
spawn(Counter {});
let find: func() -> List[Entity] = query[Counter];
print(find().len());