queue

package
v5.0.1 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Queue

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

Queue is a generic thread-safe queue.

func New

func New[T any]() *Queue[T]

New creates a new empty queue.

func (*Queue[T]) Clear

func (q *Queue[T]) Clear()

Clear removes all items from the queue.

func (*Queue[T]) Empty

func (q *Queue[T]) Empty() bool

Empty returns true if the queue has no items.

func (*Queue[T]) GetAndEmpty

func (q *Queue[T]) GetAndEmpty() []T

GetAndEmpty returns all items and clears the queue.

func (*Queue[T]) Len

func (q *Queue[T]) Len() int

Len returns the number of items in the queue.

func (*Queue[T]) Pop

func (q *Queue[T]) Pop() T

Pop removes and returns the first item. Returns zero value if empty.

func (*Queue[T]) Push

func (q *Queue[T]) Push(items ...T)

Push appends items to the queue.

Jump to

Keyboard shortcuts

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