QueryEnumerator<T1..T9>
Allocation-free query enumerator; safe under structural changes during iteration (same visiting rules as ForEach).
public ref struct QueryEnumerator<T1> where T1 : struct, IComponent
public ref struct QueryEnumerator<T1, T2> where T1 : struct, IComponent where T2 : struct, IComponent
public ref struct QueryEnumerator<T1, T2, T3> where T1 : struct, IComponent where T2 : struct, IComponent where T3 : struct, IComponent
public ref struct QueryEnumerator<T1, T2, T3, T4> where T1 : struct, IComponent where T2 : struct, IComponent where T3 : struct, IComponent where T4 : struct, IComponent
public ref struct QueryEnumerator<T1, T2, T3, T4, T5> where T1 : struct, IComponent where T2 : struct, IComponent where T3 : struct, IComponent where T4 : struct, IComponent where T5 : struct, IComponent
public ref struct QueryEnumerator<T1, T2, T3, T4, T5, T6> where T1 : struct, IComponent where T2 : struct, IComponent where T3 : struct, IComponent where T4 : struct, IComponent where T5 : struct, IComponent where T6 : struct, IComponent
public ref struct QueryEnumerator<T1, T2, T3, T4, T5, T6, T7> where T1 : struct, IComponent where T2 : struct, IComponent where T3 : struct, IComponent where T4 : struct, IComponent where T5 : struct, IComponent where T6 : struct, IComponent where T7 : struct, IComponent
public ref struct QueryEnumerator<T1, T2, T3, T4, T5, T6, T7, T8> where T1 : struct, IComponent where T2 : struct, IComponent where T3 : struct, IComponent where T4 : struct, IComponent where T5 : struct, IComponent where T6 : struct, IComponent where T7 : struct, IComponent where T8 : struct, IComponent
public ref struct QueryEnumerator<T1, T2, T3, T4, T5, T6, T7, T8, T9> where T1 : struct, IComponent where T2 : struct, IComponent where T3 : struct, IComponent where T4 : struct, IComponent where T5 : struct, IComponent where T6 : struct, IComponent where T7 : struct, IComponent where T8 : struct, IComponent where T9 : struct, IComponentAllocation-free query enumerator; safe under structural changes during iteration (same visiting rules as ForEach). A ref struct: it holds refs into the current table, so a loop over it cannot await.
Remarks
Every member the loop calls is inlined and the cold work is static (QueryWalk, by value in and out): the enumerator is never passed by reference, so its fields live in registers.
One type per number of components, 1 to 9 (generated from one template); the members below are those of each, shown for QueryEnumerator<T1>.
Properties
Current
public readonly QueryItem<T1> Current { get; }The current entity and its components.
Methods
Dispose
public void Dispose();Ends the walk early (foreach calls it); a walk that reaches the end ends by itself.
GetEnumerator
public readonly QueryEnumerator<T1> GetEnumerator();The enumerator itself (foreach support, no allocation).
MoveNext
public bool MoveNext();Move to the next matching entity. O(1) per row, plus the tables it steps over.
Last updated on
How is this guide?