Struct ScyllaRingBufferDOTS<T>.Enumerator
Value-type forward enumerator for ScyllaRingBufferDOTS<T> that enables allocation-free, Burst-compatible iteration in oldest-to-newest (FIFO) order.
Inherited Members
Namespace: Scylla.Core.Structures
Assembly: ScyllaCore.dll
Syntax
public struct ScyllaRingBufferDOTS<T>.Enumerator
Remarks
The enumerator holds a copy of the Unity.Collections.NativeArray<T> handle and snapshots of
_head, _count, and the capacity at construction time. Modifications to the ring
buffer's logical state (head, tail, count) after the enumerator is created are not reflected in
the iteration, though the underlying native memory is shared and writes to the array would be
visible.
Constructors
Enumerator(ScyllaRingBufferDOTS<T>)
Initializes a new forward enumerator for the specified ring buffer, capturing a snapshot of the buffer's current head, count, and capacity.
Declaration
public Enumerator(ScyllaRingBufferDOTS<T> ringBuffer)
Parameters
| Type | Name | Description |
|---|---|---|
| ScyllaRingBufferDOTS<T> | ringBuffer | The ring buffer to enumerate. |
Properties
Current
Gets the element at the current enumerator position.
Declaration
public T Current { get; }
Property Value
| Type | Description |
|---|---|
| T | The element at the current logical step. Undefined before the first call to
MoveNext() and after MoveNext() returns |
Methods
MoveNext()
Advances the enumerator to the next element in oldest-to-newest order and updates Current.
Declaration
public bool MoveNext()
Returns
| Type | Description |
|---|---|
| bool |
|
Remarks
The physical index is computed as (_head + _index) % _capacity using modulo arithmetic,
which is safe for Burst compilation. The enumerator visits exactly _countSnapshot
elements.