package ringdeque
import "gvisor.dev/gvisor/pkg/ringdeque"
Package ringdeque provides the Deque type.
Index ¶
- type Deque
- func (d *Deque[T]) Clear()
- func (d *Deque[T]) Empty() bool
- func (d *Deque[T]) Len() int
- func (d *Deque[T]) PeekBack() T
- func (d *Deque[T]) PeekBackPtr() *T
- func (d *Deque[T]) PeekFront() T
- func (d *Deque[T]) PeekFrontPtr() *T
- func (d *Deque[T]) PopBack() (x T)
- func (d *Deque[T]) PopFront() (x T)
- func (d *Deque[T]) PushBack(x T)
- func (d *Deque[T]) PushFront(x T)
- func (d *Deque[T]) RemoveBack()
- func (d *Deque[T]) RemoveFront()
Types ¶
type Deque ¶
type Deque[T any] struct { // contains filtered or unexported fields }
A Deque implements a double-ended queue of values of type T using a resizable ring buffer.
Deque is not safe to use concurrently from multiple goroutines.
func (*Deque[T]) Clear ¶
func (d *Deque[T]) Clear()
Clear removes all values from d.
func (*Deque[T]) Empty ¶
Empty returns true if r contains no values.
func (*Deque[T]) Len ¶
Len returns the number of values in d.
func (*Deque[T]) PeekBack ¶
func (d *Deque[T]) PeekBack() T
PeekBack returns the value at the back of d.
Preconditions: !d.Empty().
func (*Deque[T]) PeekBackPtr ¶
func (d *Deque[T]) PeekBackPtr() *T
PeekBackPtr returns a pointer to the value at the back of d. The pointer is only valid until the next mutation of d.
Preconditions: !d.Empty().
func (*Deque[T]) PeekFront ¶
func (d *Deque[T]) PeekFront() T
PeekFront returns the value at the front of d.
Preconditions: !d.Empty().
func (*Deque[T]) PeekFrontPtr ¶
func (d *Deque[T]) PeekFrontPtr() *T
PeekFrontPtr returns a pointer to the value at the front of d. The pointer is only valid until the next mutation of d.
Preconditions: !d.Empty().
func (*Deque[T]) PopBack ¶
func (d *Deque[T]) PopBack() (x T)
PopBack removes and returns the value at the back of d.
Preconditions: !d.Empty().
func (*Deque[T]) PopFront ¶
func (d *Deque[T]) PopFront() (x T)
PopFront removes and returns the value at the front of d.
Preconditions: !d.Empty().
func (*Deque[T]) PushBack ¶
func (d *Deque[T]) PushBack(x T)
PushBack inserts x at the back of d.
func (*Deque[T]) PushFront ¶
func (d *Deque[T]) PushFront(x T)
PushFront inserts x at the front of d.
func (*Deque[T]) RemoveBack ¶
func (d *Deque[T]) RemoveBack()
RemoveBack removes the value at the back of d.
Preconditions: !d.Empty().
func (*Deque[T]) RemoveFront ¶
func (d *Deque[T]) RemoveFront()
RemoveFront removes the value at the front of d.
Preconditions: !d.Empty().
Source Files ¶
ringdeque.go
- Version
- v0.0.0-20250605235530-a6711d1e1dc6 (latest)
- Published
- Jun 5, 2025
- Platform
- linux/amd64
- Last checked
- 4 hours ago –
Tools for package owners.