ringbuf

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2024 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffer

type Buffer[T any] struct {
	// contains filtered or unexported fields
}

func NewExpandableBuffer

func NewExpandableBuffer[T any](initialSize, maximumSize int) (result *Buffer[T])

func (*Buffer[T]) Add

func (list *Buffer[T]) Add(item T)

Add adds an item to the buffer

func (*Buffer[T]) Clear

func (hist *Buffer[T]) Clear()

func (*Buffer[T]) Initialize

func (hist *Buffer[T]) Initialize(initialSize, maximumSize int)

func (*Buffer[T]) Length

func (hist *Buffer[T]) Length() int

func (*Buffer[T]) Match

func (list *Buffer[T]) Match(ascending bool, predicate Predicate[T], limit int) []T

func (*Buffer[T]) Pop

func (list *Buffer[T]) Pop() (item T, success bool)

func (*Buffer[T]) Range

func (list *Buffer[T]) Range(ascending bool, rangeFunction func(item *T) (stopIteration bool))

type Predicate

type Predicate[T any] func(item *T) (matches bool)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL