ringi64

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2021 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 {
	// contains filtered or unexported fields
}

Ring is a fixed-size circular buffer.

func MakeRing

func MakeRing(cap int) Ring

Make makes a new instance of the ring buffer with given capacity.

func (*Ring) Back

func (r *Ring) Back() (value int64)

Back returns the last item of the buffer.

func (*Ring) Cap

func (r *Ring) Cap() int

Cap returns maximum capacity of the ring buffer.

func (*Ring) CopyTo

func (r *Ring) CopyTo(dst []int64) (n int)

Copy makes copy of the ring buffer to dst slice. Returns count of copied items.

func (*Ring) ForcePushBack

func (r *Ring) ForcePushBack(value int64)

ForcePushBack adds new item to the end of buffer and deletes first item if buffer is full.

func (*Ring) Front

func (r *Ring) Front() (value int64)

Front returns the first item of the buffer.

func (*Ring) Full

func (r *Ring) Full() bool

Full returns true if the buffer is full.

func (*Ring) Len

func (r *Ring) Len() int

Len returns count of items.

func (*Ring) PopFront

func (r *Ring) PopFront() (value int64)

PopFront deletes first item and returns it.

func (*Ring) PushBack

func (r *Ring) PushBack(value int64)

PushBack adds new item to the end of the buffer.

Jump to

Keyboard shortcuts

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