clist

package
v0.0.0-...-a4757fd Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2018 License: Apache-2.0, Apache-2.0, Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CElement

type CElement struct {
	Value interface{}
	// contains filtered or unexported fields
}

CElement is an element of a linked-list Traversal from a CElement are goroutine-safe.

func (*CElement) DetachNext

func (e *CElement) DetachNext()

func (*CElement) DetachPrev

func (e *CElement) DetachPrev()

func (*CElement) Next

func (e *CElement) Next() *CElement

Nonblocking, may return nil if at the end.

func (*CElement) NextWait

func (e *CElement) NextWait() *CElement

Blocking implementation of Next(). May return nil iff CElement was tail and got removed.

func (*CElement) Prev

func (e *CElement) Prev() *CElement

Nonblocking, may return nil if at the end.

func (*CElement) PrevWait

func (e *CElement) PrevWait() *CElement

Blocking implementation of Prev(). May return nil iff CElement was head and got removed.

func (*CElement) Removed

func (e *CElement) Removed() bool

type CList

type CList struct {
	// contains filtered or unexported fields
}

CList represents a linked list. The zero value for CList is an empty list ready to use. Operations are goroutine-safe.

func New

func New() *CList

func (*CList) AppendList

func (l *CList) AppendList(l2 *CList)

TODO whatif one of l2's element is waiting for efficient, don't want to check every element

func (*CList) Back

func (l *CList) Back() *CElement

func (*CList) BackWait

func (l *CList) BackWait() *CElement

func (*CList) Clear

func (l *CList) Clear()

func (*CList) Front

func (l *CList) Front() *CElement

func (*CList) FrontWait

func (l *CList) FrontWait() *CElement

func (*CList) Init

func (l *CList) Init() *CList

func (*CList) Len

func (l *CList) Len() int

func (*CList) PushBack

func (l *CList) PushBack(v interface{}) *CElement

func (*CList) Remove

func (l *CList) Remove(e *CElement) interface{}

CONTRACT: Caller must call e.DetachPrev() and/or e.DetachNext() to avoid memory leaks. NOTE: As per the contract of CList, removed elements cannot be added back.

Jump to

Keyboard shortcuts

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