Import std.collections.ring_buffer
std.collections.ring_buffer
RingBuffer<T>: the last values added, up to its Capacity, oldest first. Adding to a full one
drops the oldest, which makes it a history, or a window over what came last. Its values are in
a fixed array of slots, from Head on, round to the start.
std/collections/ring_buffer.fb
Types
RingBuffer
class
@DebugElements Public Class RingBuffer<T> Implements Iterable<T>, Cloneable
A queue of up to its Capacity, where a value added to a full one takes the place of the oldest.
std/collections/ring_buffer.fb, line 9
-
An empty RingBuffer that holds up to
capacityvalues, which must be 1 or more. -
How many values it holds.
-
How many values it holds at most.
-
Whether the next Add drops the oldest value.
-
Adds the
valueas the newest, dropping the oldest when the RingBuffer is full. -
Adds each of the
valuesin turn, so the last Capacity of them stay. -
Takes the oldest value off and gives it. Panics when the RingBuffer is empty.
-
Takes the newest value off and gives it. Panics when the RingBuffer is empty.
-
Takes the oldest value off and gives it, or Null when the RingBuffer is empty.
-
Takes the newest value off and gives it, or Null when the RingBuffer is empty.
-
The oldest value, which stays. Panics when the RingBuffer is empty.
-
The newest value, which stays. Panics when the RingBuffer is empty.
-
The oldest value, or Null when the RingBuffer is empty.
-
The newest value, or Null when the RingBuffer is empty.
-
The value at index, counting from the oldest, which is 0. Panics unless index is from 0 to Count minus 1.
-
Gives the value at index, counting from the oldest, a new value.
-
Whether it holds
value. -
Takes every value out.
-
The values, oldest first, in a new array.
-
A new RingBuffer with the same values and Capacity.
-
The values, oldest first. Adding or removing a value while going over them panics.
RingBufferIterator
struct
Public Struct RingBufferIterator<T> Implements Iterator<T>
The values of a RingBuffer, oldest first, which For ... In goes over.
std/collections/ring_buffer.fb, line 193
-
The next value, or Null when there are no more.
Doc from
std.core.iterator.Iterator.Next.
Extends
RingBuffer
extend
Extend RingBuffer<T> Implements Printable
No doc comment.
std/collections/ring_buffer.fb, line 211
-
Its text, as a string interpolation like "{value}" shows it.
Doc from
std.core.interfaces.Printable.ToString.
Report an issue with this page or with FutureBlitz on GitHub.