Struct ScyllaRingBufferDOTS<T>.ReverseEnumerator
Value-type reverse enumerator for ScyllaRingBufferDOTS<T> that enables allocation-free, Burst-compatible iteration in newest-to-oldest order.
Inherited Members
Namespace: Scylla.Core.Structures
Assembly: ScyllaCore.dll
Syntax
public struct ScyllaRingBufferDOTS<T>.ReverseEnumerator
Remarks
The enumerator captures the ring buffer's _tail, _count, and capacity at construction
time. The newest element's physical index is _tail - 1 (with wraparound). Subsequent elements
are obtained by decrementing the physical index by one at each step, with modulo correction applied
when the result is negative.
Modifications to the ring buffer's logical state after the enumerator is created are not reflected in the iteration bounds, though the underlying native memory is shared.
Constructors
ReverseEnumerator(ScyllaRingBufferDOTS<T>)
Initializes a new reverse enumerator for the specified ring buffer, capturing a snapshot of the buffer's current tail, count, and capacity.
Declaration
public ReverseEnumerator(ScyllaRingBufferDOTS<T> ringBuffer)
Parameters
| Type | Name | Description |
|---|---|---|
| ScyllaRingBufferDOTS<T> | ringBuffer | The ring buffer to enumerate in reverse. |
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 reverse-order step. Undefined before the first call to
MoveNext() and after MoveNext() returns |
Methods
MoveNext()
Advances the enumerator to the next element in newest-to-oldest order and updates Current.
Declaration
public bool MoveNext()
Returns
| Type | Description |
|---|---|
| bool |
|
Remarks
The physical index is computed as _tail - 1 - _index. When this value is negative,
_capacity is added to wrap around to the end of the backing array. The enumerator
visits exactly _countSnapshot elements.