package
Version:
v0.1.4
Opens a new window with list of versions in this module.
Published: Sep 28, 2023
License: Apache-2.0, BSD-2-Clause
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
type Queue[T any] struct {
}
Queue represents a ring buffer.
New creates a new queue with the specified capacity.
Capacity returns the capacity of the queue.
Offer adds an element to the queue and returns true.
If the queue is full, it drops it and returns false.
func (queue *Queue[T]) Poll() (element T, success bool)
Poll returns and removes the oldest element in the queue and true if successful.
If returns false if the queue is empty.
Size returns the size of the queue.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.