Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue represents a single instance of the queue data structure.
func (*Queue) Add ¶
func (q *Queue) Add(elem interface{})
Add puts an element on the end of the queue.
func (*Queue) Get ¶
Get returns the element at index i in the queue. If the index is invalid, the call will panic. This method accepts both positive and negative index values. Index 0 refers to the first element, and index -1 refers to the last.
type QueueGen ¶ added in v0.1.23
type QueueGen[T any] struct { // contains filtered or unexported fields }
QueueGen is a generic ring-buffer queue. It is not thread-safe. Use SyncQueue for concurrent access.
func NewQueueGen ¶ added in v0.1.23
NewQueueGen constructs a new generic queue.
func (*QueueGen[T]) Add ¶ added in v0.1.23
func (q *QueueGen[T]) Add(elem T)
Add puts an element on the end of the queue.
func (*QueueGen[T]) Get ¶ added in v0.1.23
Get returns the element at index i (0 = head, -1 = last). Panics if out of range.
type SyncQueue ¶
type SyncQueue struct {
// contains filtered or unexported fields
}
SyncQueue Synchronous FIFO queue
func (*SyncQueue) Pop ¶
func (q *SyncQueue) Pop() (v interface{})
Pop Pop an item from SyncQueue, will block if SyncQueue is empty