list

package
v0.9.7 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2024 License: Unlicense Imports: 3 Imported by: 1

Documentation

Overview

Package list implements a locking list.l

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrElementNotInList = errors.New("element not in list")
	ErrMarkNotInList    = errors.New("mark not in list")
	ErrNilValue         = errors.New("nil element")
	ErrUninitialized    = errors.New("uninitialized list")
)

Functions

This section is empty.

Types

type Element

type Element struct {
	*list.Element
	// contains filtered or unexported fields
}

func (*Element) Next

func (e *Element) Next() *Element

func (*Element) Prev

func (e *Element) Prev() *Element

func (*Element) Value

func (e *Element) Value() any

type LockingList

type LockingList struct {
	*sync.RWMutex
	// contains filtered or unexported fields
}

func New

func New() *LockingList

func (*LockingList) Back

func (ll *LockingList) Back() *Element

func (*LockingList) Front

func (ll *LockingList) Front() *Element

func (*LockingList) Init

func (ll *LockingList) Init() *LockingList

Init initializes or clears list l.

func (*LockingList) InsertAfter

func (ll *LockingList) InsertAfter(v any, mark *Element) (*Element, error)

func (*LockingList) InsertBefore

func (ll *LockingList) InsertBefore(v any, mark *Element) (*Element, error)

func (*LockingList) Len

func (ll *LockingList) Len() int

func (*LockingList) Lock

func (ll *LockingList) Lock() error

func (*LockingList) MoveAfter

func (ll *LockingList) MoveAfter(e, mark *Element) error

func (*LockingList) MoveToBack

func (ll *LockingList) MoveToBack(e *Element) error

func (*LockingList) MoveToFront

func (ll *LockingList) MoveToFront(e *Element) error

func (*LockingList) Pop

func (ll *LockingList) Pop() any

func (*LockingList) Push

func (ll *LockingList) Push(item any) (err error)

func (*LockingList) PushBack

func (ll *LockingList) PushBack(v any) *Element

func (*LockingList) PushBackList

func (ll *LockingList) PushBackList(other *LockingList) error

func (*LockingList) PushFront

func (ll *LockingList) PushFront(v any) *Element

func (*LockingList) PushFrontList

func (ll *LockingList) PushFrontList(other *LockingList) error

func (*LockingList) RLock

func (ll *LockingList) RLock() error

func (*LockingList) RUnlock

func (ll *LockingList) RUnlock()

func (*LockingList) Remove

func (ll *LockingList) Remove(elm *Element) error

func (*LockingList) Rotate

func (ll *LockingList) Rotate() *Element

Rotate moves the first element to the back of the list and returns it.

func (*LockingList) Unlock

func (ll *LockingList) Unlock()

Jump to

Keyboard shortcuts

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