Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GrowingRing ¶
type GrowingRing[T any] struct { // contains filtered or unexported fields }
func NewGrowingRing ¶
func NewGrowingRing[T any](capacity int64) *GrowingRing[T]
NewGrowingRing creates a growing ring buffer with the given capacity (rounded up to nearest power of 2).
func (*GrowingRing[T]) Len ¶
func (rb *GrowingRing[T]) Len() int64
Len returns the number of items in the buffer.
func (*GrowingRing[T]) Pop ¶
func (rb *GrowingRing[T]) Pop() (T, bool)
Pop removes and returns the first item, or false if empty.
func (*GrowingRing[T]) PopN ¶
func (rb *GrowingRing[T]) PopN(n int64) ([]T, bool)
PopN removes up to n items and returns them, or false if empty.
func (*GrowingRing[T]) Push ¶
func (rb *GrowingRing[T]) Push(item T)
Push appends an item to the buffer, growing if necessary.
Click to show internal directories.
Click to hide internal directories.