ring

package
v0.0.0-...-ade9fc0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ring

type Ring struct {
	Value []interface{}
	// contains filtered or unexported fields
}

Ring ring buffer use an array.

func New

func New(maxsize int) *Ring

New creates a ring with maxsize capacity.

func (*Ring) Back

func (r *Ring) Back() (interface{}, error)

Back get back element, not delete back element.

func (*Ring) CurSize

func (r *Ring) CurSize() int

CurSize returns the number of elements in ring r.

func (*Ring) Do

func (r *Ring) Do(f func(interface{}))

Do calls function f on each element of the ring r, in forward order.

func (*Ring) Front

func (r *Ring) Front() (interface{}, error)

Front get front element, not delete front element.

func (*Ring) MaxSize

func (r *Ring) MaxSize() int

MaxSize returns the capacity of the ring r.

func (*Ring) PopBack

func (r *Ring) PopBack() (interface{}, error)

PopBack pop out an element in the ring tail.

func (*Ring) PopFront

func (r *Ring) PopFront() (interface{}, error)

PopFront pop out an element in the ring head.

func (*Ring) PushBack

func (r *Ring) PushBack(value interface{}) error

PushBack push a new element to the ring tail.

func (*Ring) PushFront

func (r *Ring) PushFront(value interface{}) error

PushFront push a new element to the ring head.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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