Versions in this module Expand all Collapse all v0 v0.19.4 Nov 1, 2026 Changes in this version + var ErrQueueClosed = errors.New("队列已关闭") + var ErrQueueEmpty = errors.New("队列为空") + var ErrQueueFull = errors.New("队列已满") + type BoundedQueue struct + func NewBoundedQueue[T any](minCap, maxCap int) *BoundedQueue[T] + func (q *BoundedQueue[T]) Cap() int + func (q *BoundedQueue[T]) Close() + func (q *BoundedQueue[T]) Dequeue(ctx context.Context) (T, error) + func (q *BoundedQueue[T]) DequeueTimeout(timeout time.Duration) (T, error) + func (q *BoundedQueue[T]) Enqueue(ctx context.Context, item T) error + func (q *BoundedQueue[T]) IsClosed() bool + func (q *BoundedQueue[T]) IsEmpty() bool + func (q *BoundedQueue[T]) SetAutoResize(enabled bool) + func (q *BoundedQueue[T]) Size() int + func (q *BoundedQueue[T]) Stats() map[string]interface{} + func (q *BoundedQueue[T]) TryDequeue() (T, bool) + type Deque struct + func NewDeque() *Deque + func (q *Deque) At(i int) interface{} + func (q *Deque) Back() (interface{}, error) + func (q *Deque) Cap() int + func (q *Deque) Clear() + func (q *Deque) Front() (interface{}, error) + func (q *Deque) Grow(n int) + func (q *Deque) Index(f func(interface{}) bool) int + func (q *Deque) Insert(i int, item interface{}) + func (q *Deque) Iter() func(func(interface{}) bool) + func (q *Deque) IterPopBack() func(func(interface{}) bool) + func (q *Deque) IterPopFront() func(func(interface{}) bool) + func (q *Deque) Len() int + func (q *Deque) PopBack() interface{} + func (q *Deque) PopFront() interface{} + func (q *Deque) PushBack(elem interface{}) + func (q *Deque) PushFront(elem interface{}) + func (q *Deque) RIndex(f func(interface{}) bool) int + func (q *Deque) RIter() func(func(interface{}) bool) + func (q *Deque) Rotate(n int) + func (q *Deque) Set(i int, item interface{}) + type FIFOQueue struct + func NewFIFOQueue(capacity int, autoResize bool) *FIFOQueue + func (q *FIFOQueue) Capacity() int + func (q *FIFOQueue) Dequeue(ctx context.Context) (interface{}, error) + func (q *FIFOQueue) Enqueue(ctx context.Context, item interface{}) error + func (q *FIFOQueue) GrowthFactor() float64 + func (q *FIFOQueue) IsEmpty() bool + func (q *FIFOQueue) MinCapacity() int + func (q *FIFOQueue) SetGrowthFactor(value float64) *FIFOQueue + func (q *FIFOQueue) SetShrinkFactor(value float64) *FIFOQueue + func (q *FIFOQueue) ShrinkFactor() float64 + func (q *FIFOQueue) Size() int + type Item struct + type LIFOQueue struct + func NewLIFOQueue() *LIFOQueue + func (l *LIFOQueue) Dequeue(ctx context.Context) (interface{}, error) + func (l *LIFOQueue) Enqueue(ctx context.Context, item interface{}) error + func (l *LIFOQueue) IsEmpty() bool + func (l *LIFOQueue) Size() int + type PriorityQueue struct + func NewPriorityQueue() *PriorityQueue + func (pq *PriorityQueue) Dequeue(ctx context.Context) (interface{}, error) + func (pq *PriorityQueue) Enqueue(ctx context.Context, item interface{}, priority int) error + func (pq *PriorityQueue) IsEmpty() bool + func (pq *PriorityQueue) Len() int + func (pq *PriorityQueue) Less(i, j int) bool + func (pq *PriorityQueue) Pop() interface{} + func (pq *PriorityQueue) Push(x interface{}) + func (pq *PriorityQueue) Size() int + func (pq *PriorityQueue) Swap(i, j int) + type Queue interface + Dequeue func(ctx context.Context) (interface{}, error) + Enqueue func(ctx context.Context, item interface{}) error + IsEmpty func() bool + Size func() int