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 { // Enqueue appends the element `e` at the tail of the queue. // If the queue is bounded, and the number of existing elements // equals the capacity, then Enqueue returns false without // modifiying the queue; otherwise Enqueue returns true. Enqueue(e T) bool // Dequeue removes the element at the head of the queue. // If the queue is empty, then Dequeue returns (zero,false) without // modifying the queue; otherwise Dequeue returns (element,true). Dequeue() (T, bool) // Capacity returns the maximum number of elements that are // allowed in the bounded queue. If the queue is unbounded, // then Capacity returns -1. Capacity() int // CurrentUse returns the number of elements currently in the queue. CurrentUse() int // PeakUse returns the maximum number of elements that have been in the queue. PeakUse() int }
The type Queue specifies a first-in, first-out, goroutine-safe queue.
func NewBoundedQueue ¶
NewBoundedQueue returns a bounded queue that allows the maximum of `capacity` elements.
Click to show internal directories.
Click to hide internal directories.