Documentation ¶
Overview ¶
Package queue implements a generic queue using a ring buffer.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Interface ¶
type Interface interface { // Len returns the number of elements available. Len() int // Clear removes the element at i. Clear(i int) }
A type implementing Interface can be used to store elements in a Queue.
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
A Queue wraps an Interface to provide queue operations.
func New ¶
New creates a new queue that starts with n elements. The interface's length must not change over the course of the queue's usage.
func (*Queue) Front ¶
Front returns the index of the front of the queue, or -1 if the queue is empty.
func (*Queue) Len ¶
Len returns the length of the queue. This is different from the underlying interface's length, which is the queue's capacity.
Click to show internal directories.
Click to hide internal directories.