Documentation ¶
Index ¶
- type BlockingDequeue
- func (d *BlockingDequeue[T]) IsEmpty() bool
- func (d *BlockingDequeue[T]) IsFull() bool
- func (d *BlockingDequeue[T]) PeekBack() T
- func (d *BlockingDequeue[T]) PeekFront() T
- func (d *BlockingDequeue[T]) PopBack() T
- func (d *BlockingDequeue[T]) PopFront() T
- func (d *BlockingDequeue[T]) PushBack(item T)
- func (d *BlockingDequeue[T]) PushFront(item T)
- func (d *BlockingDequeue[T]) Size() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockingDequeue ¶
type BlockingDequeue[T any] struct { // contains filtered or unexported fields }
Blocking dequeue, implemented with a circular buffer. The dequeue is thread safe. And must not be copied.
func NewBlockingDequeue ¶
func NewBlockingDequeue[T any](buffer []T) *BlockingDequeue[T]
Creates a new blocking dequeue with the provided buffer. The dequeue MUST only be created using this method.
func (*BlockingDequeue[T]) IsEmpty ¶
func (d *BlockingDequeue[T]) IsEmpty() bool
Return true if the dequeue is empty.
func (*BlockingDequeue[T]) IsFull ¶
func (d *BlockingDequeue[T]) IsFull() bool
Return true if the dequeue is full.
func (*BlockingDequeue[T]) PeekBack ¶
func (d *BlockingDequeue[T]) PeekBack() T
Read the last item of the dequeue without removing it. Blocks if the dequeue is empty.
func (*BlockingDequeue[T]) PeekFront ¶
func (d *BlockingDequeue[T]) PeekFront() T
Read the first item of the dequeue without removing it. Blocks if the dequeue is empty.
func (*BlockingDequeue[T]) PopBack ¶
func (d *BlockingDequeue[T]) PopBack() T
Read the last item (at the end/back) of the dequeue and remove it. Blocks if the dequeue is empty.
func (*BlockingDequeue[T]) PopFront ¶
func (d *BlockingDequeue[T]) PopFront() T
Read the first item (on the top/front) of the dequeue and remove it. Blocks if the dequeue is empty.
func (*BlockingDequeue[T]) PushBack ¶
func (d *BlockingDequeue[T]) PushBack(item T)
Add an item to the back (bottom) of the dequeue. Blocks if dequeue is full.
func (*BlockingDequeue[T]) PushFront ¶
func (d *BlockingDequeue[T]) PushFront(item T)
Add an item into the front (top) of the dequeue. Blocks if dequeue is full.
func (*BlockingDequeue[T]) Size ¶
func (d *BlockingDequeue[T]) Size() int
Return the number of elements in the dequeue.