queue

package
v0.0.0-...-6b6cd0b Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2022 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
}

Generic queue gaurded by a mutex.

func New

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

Create a new queue

func (*Queue[T]) Dequeue

func (queue *Queue[T]) Dequeue() (value T, ok bool)

Take the next item off the front of the queue If the queue is empty, ok is false

func (*Queue[T]) Empty

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

Returns true is there are no items in the queue

func (*Queue[T]) Enqueue

func (queue *Queue[T]) Enqueue(value T)

Put an item on the end of a queue

func (*Queue[T]) Len

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

Return the number of items in the queue

func (*Queue[T]) Peek

func (queue *Queue[T]) Peek() (value T, ok bool)

Return the first item in the queue without removing it If queue is empty, ok is false

Jump to

Keyboard shortcuts

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