xqueue

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: Apache-2.0 Imports: 0 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] interface {
	// Push appends a value to the back of the queue.
	Push(value T)
	// Pop removes and returns the value at the front of the queue.
	// It panics if the queue is empty.
	Pop() T
	// Len returns the number of values in the queue.
	Len() int
	// Reset empties the queue and releases the backing storage.
	Reset()
}

Queue is a FIFO queue. Popped slots are zeroed so that dequeued values are not pinned in memory, and the backing storage is reused in place: a balanced push/pop workload does not allocate in steady state, and a sustained imbalance (one producer permanently ahead of the consumer) keeps the storage bounded to the peak depth rather than letting a dead prefix grow without bound.

Queue is not safe for concurrent use.

func NewQueue

func NewQueue[T any]() Queue[T]

NewQueue creates a new empty FIFO queue.

Jump to

Keyboard shortcuts

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