Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RingBuffer ¶
type RingBuffer[T any] struct { // contains filtered or unexported fields }
func New ¶
func New[T any](size int) *RingBuffer[T]
New is a fixed-size ring/circle buffer of values.
func (*RingBuffer[T]) Count ¶
func (b *RingBuffer[T]) Count() int
Count the number of records in the buffer
func (*RingBuffer[T]) Peek ¶
func (b *RingBuffer[T]) Peek() (bool, T)
Peek an item from the ring buffer
func (*RingBuffer[T]) Pop ¶
func (b *RingBuffer[T]) Pop() (bool, T)
Pop an item from the ring buffer
func (*RingBuffer[T]) Push ¶
func (b *RingBuffer[T]) Push(item T) error
Push an item into the ring-buffer. Returns an error if we overflow the buffer
Click to show internal directories.
Click to hide internal directories.