Documentation
¶
Index ¶
- type Queue
- func (q *Queue[T]) Empty() bool
- func (q *Queue[T]) Get(i int) T
- func (q *Queue[T]) Len() int
- func (q *Queue[T]) Pop() (v T, ok bool)
- func (q *Queue[T]) PopWithPool(pool *array.Pool[T]) (v T, ok bool)
- func (q *Queue[T]) Ptr(i int) *T
- func (q *Queue[T]) Push(v T)
- func (q *Queue[T]) PushWithPool(v T, pool *array.Pool[T])
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Queue ¶
type Queue[T any] struct { // contains filtered or unexported fields }
Queue implements a FIFO queue backed by an array.Array for efficient block-based allocations.
func (*Queue[T]) Get ¶
Get obtains the value of an entry at a specific offset. Like a Go slice this results in a panic if the value is outside the array bounds.
func (*Queue[T]) Pop ¶
Pop removes the oldest value from the queue in FIFO order if any are available.
func (*Queue[T]) PopWithPool ¶
PopWithPool removes the oldest value from the queue in FIFO order if any are available. If the removed value was the only item remaining in the block of the backing array.Array, that block will be returned to the pool.
func (*Queue[T]) Ptr ¶
Ptr obtains the pointer to a value for an entry at a specific offset. The returned pointer is guaranteed not to change until the index is popped from the array. Like a Go slice this results in a panic if the value is outside the array bounds.
func (*Queue[T]) PushWithPool ¶
PushWithPool adds a new value to the end of the queue. If a new block is required by the backing array.Array, it will be allocated from the pool.