queue

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OverflowQueue

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

OverflowQueue is a thread safe queue implementation with max size, and the oldest elements automatically overflow.

func New

func New[T any](size int) *OverflowQueue[T]

func (*OverflowQueue[T]) Append

func (q *OverflowQueue[T]) Append(value T)

Append adds an element to the queue

func (*OverflowQueue[T]) Items

func (q *OverflowQueue[T]) Items() []T

Items returns a copy of the elements in the queue

func (*OverflowQueue[T]) Length

func (q *OverflowQueue[T]) Length() int

Length returns the current length of the queue

func (*OverflowQueue[T]) ReversedItems

func (q *OverflowQueue[T]) ReversedItems() []T

ReversedItems returns a reversed copy of the elements in the queue

func (*OverflowQueue[T]) String added in v0.10.0

func (q *OverflowQueue[T]) String() string

String returns a string representation of the queue

Jump to

Keyboard shortcuts

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