Struct NativeCircularBuffer Extends IReadOnlyList<T>, IReadOnlyCollection<T>

Public

Implements an efficient circular buffer that can be appended to in both directions.

Public Methods

AddRange (items)

Appends a list of items to the end of the buffer.

Clear ()

Resets the buffer's length to zero.

Clone ()
Dispose ()

Releases the unmanaged memory held by this container.

GetAbsolute (index)

Indexes the buffer using absolute indices.

Return either the first element or the last element.

Grow ()
MoveAbsolute (startIndex, endIndex, deltaIndex)
Pop (fromStart)

Pops either from the start or from the end of the buffer.

PopEnd ()

Removes and returns the last element.

Removes and returns the first element.

Push (toStart, item)

Pushes a new item to the start or the end of the buffer.

PushEnd (item)

Pushes a new item to the end of the buffer.

PushStart (item)

Pushes a new item to the start of the buffer.

Splice (startIndex, toRemove, toInsert)

Removes toRemove items from the buffer, starting at startIndex, and then inserts the toInsert items at startIndex.

SpliceAbsolute (startIndex, toRemove, toInsert)

Like Splice, but startIndex is an absolute index.

SpliceUninitialized (startIndex, toRemove, toInsert)

Like Splice, but the newly inserted items are left in an uninitialized state.

SpliceUninitializedAbsolute (startIndex, toRemove, toInsert)

Like SpliceUninitialized, but startIndex is an absolute index.

TrimTo (length)

Lowers the length of the buffer to the given value, and does nothing if the given value is greater or equal to the current length.

Public Variables

AbsoluteEndIndex

Absolute index of the last item in the buffer, may be negative or greater than Length.

Public Readonly
AbsoluteStartIndex

Absolute index of the first item in the buffer, may be negative or greater than Length.

Public Readonly
Allocator

The allocator used to create the internal buffer.

Public
Count
Public Readonly
First

First item in the buffer throws if the buffer is empty.

Public Readonly
IsCreated
Public Readonly
Last

Last item in the buffer, throws if the buffer is empty.

Public Readonly
Length

Number of items in the buffer.

Public Readonly
capacityMask

Capacity of the allocation minus 1.

Public
length
Public
this[int index]

Indexes the buffer, with index 0 being the first element.

Public

Private/Protected Members

data
Internal
head
Internal