Documentation
¶
Index ¶
- type Elem
- type Queue
- func (q *Queue) Cap() int
- func (q *Queue) Elems() []Elem
- func (q *Queue) Empty() bool
- func (q *Queue) Get(i int) (e Elem)
- func (q *Queue) Grow(n int)
- func (q *Queue) Len() int
- func (q *Queue) Pop() (v Elem, ok bool)
- func (q *Queue) PopN(elems []Elem) (n int)
- func (q *Queue) Push(e Elem)
- func (q *Queue) PushN(elems []Elem)
- func (q *Queue) Reset()
- func (q *Queue) Skip(n int) int
- type SyncQueue
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 queue. The zero value for Queue is an empty queue ready to use.
func New ¶
New creates and initializes a new Queue using buf as its initial contents. The new Queue takes ownership of buf, and the caller should not use buf after this call. New is intended to prepare a Queue to read existing data. It can also be used to set the initial size of the internal queue for writing. To do that, buf should have the desired capacity but a length of zero.
In most cases, new(Queue) (or just declaring a Queue variable) is sufficient to initialize a Queue.
func (*Queue) Get ¶
Get returns the element at index i in the queue. If the index is invalid, the call will panic.
func (*Queue) Grow ¶
Grow grows the queue's capacity, if necessary, to guarantee space for another n elements. After Grow(n), at least n elements can be pushed to the queue without another allocation. If n is negative, Grow will panic.
func (*Queue) Pop ¶
Pop removes and returns the front element from the queue. Ok is true if the queue is empty, otherwise is false.
func (*Queue) PopN ¶
PopN copies and removes the front len(elems) elements from the queue or until the queue is drained. The return value n is the number of elements copied.