queue

package
v0.0.0-...-38a5715 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package queue implements of a circular queue.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	Name string
}

Data represents what is being stored on the queue.

type Queue

type Queue struct {
	Count int
	// contains filtered or unexported fields
}

Queue represents a list of data.

func New

func New(cap int) (*Queue, error)

New returns a queue with a set capacity.

func (*Queue) Dequeue

func (q *Queue) Dequeue() (*Data, error)

Dequeue removes data into the queue if data exists.

func (*Queue) Enqueue

func (q *Queue) Enqueue(data *Data) error

Enqueue inserts data into the queue if there is available capacity.

func (*Queue) Operate

func (q *Queue) Operate(f func(d *Data) error) error

Operate accepts a function that takes data and calls the specified function for every piece of data found.

Jump to

Keyboard shortcuts

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