ringdeque

package
v0.0.0-...-1a9f8b1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 23, 2024 License: Apache-2.0, MIT Imports: 0 Imported by: 0

Documentation

Overview

Package ringdeque provides the Deque type.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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

func (d *Deque[T]) Empty() bool

Empty returns true if r contains no values.

func (*Deque[T]) Len

func (d *Deque[T]) Len() int

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().

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL