queue

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2022 License: Apache-2.0 Imports: 1 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
}

OverflowQeueue 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

Jump to

Keyboard shortcuts

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