list

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2022 License: MIT Imports: 3 Imported by: 0

README

container-list genny generics

generate by [Genny]

double linked-list lik a kernel list_head.

"container/list" package is very slow, occur heavy heap allocation. you cannot use in LRU list.

see detail Improving 'container/list'.

generate

    $ wget -q -O - "https://github.com/kazu/loncha/master/container_list/container_list.go" | genny  gen "ListEntry=Player" > player_list.go
    $ wget -q -O - "https://github.com/kazu/loncha/master/container_list/container_list_test.go" | genny  gen "ListEntry=Player" > player_list_test.go

References

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ListEntry

type ListEntry struct {
	ID   int
	Name string
	list_head.ListHead
}

ListEntry ... dummy struct.liked-list like a kernel list head.

func New

func New() (l *ListEntry)

func NewListEntryList

func NewListEntryList(h *ListEntry) *ListEntry

NewListEntryList ... New returns an initialized list.

func (*ListEntry) Add

func (d *ListEntry) Add(n *ListEntry) *ListEntry

Add ... insert n after d

func (*ListEntry) Back

func (d *ListEntry) Back() *ListEntry

Back ... last entry of linked-list

func (*ListEntry) ContainOf

func (d *ListEntry) ContainOf(ptr *list_head.ListHead) *ListEntry

ContainOf ... find same entry of ptr

func (*ListEntry) Delete

func (d *ListEntry) Delete() *ListEntry

Delete ... delete d from linked-list

func (*ListEntry) Each

func (l *ListEntry) Each(fn func(e *ListEntry))

func (*ListEntry) Front

func (d *ListEntry) Front() *ListEntry

Front ... first value of ListEntry

func (*ListEntry) Init

func (d *ListEntry) Init()

func (*ListEntry) InsertAfter

func (l *ListEntry) InsertAfter(v *ListEntry) *ListEntry

InsertAfter ... inserts a new element e with value v immediately after mark and returns e. If mark is not an element of l, the list is not modified.

func (*ListEntry) InsertBefore

func (l *ListEntry) InsertBefore(v *ListEntry) *ListEntry

InsertBefore inserts a new element e with value v immediately before mark and returns e. If mark is not an element of l, the list is not modified.

func (*ListEntry) Len

func (d *ListEntry) Len() int

Len ... size of list

func (*ListEntry) MoveAfter

func (l *ListEntry) MoveAfter(v *ListEntry) *ListEntry

MoveAfter ... moves element e to its new position after mark. If e is not an element of l, or e == mark, the list is not modified.

func (*ListEntry) MoveBefore

func (l *ListEntry) MoveBefore(v *ListEntry) *ListEntry

MoveBefore ... moves element e to its new position before mark. If e or mark is not an element of l, or e == mark, the list is not modified.

func (*ListEntry) MoveToBack

func (l *ListEntry) MoveToBack(v *ListEntry) *ListEntry

MoveToBack ... moves element e to later of list l. If e is not an element of l, the list is not modified.

func (*ListEntry) MoveToFront

func (l *ListEntry) MoveToFront(v *ListEntry) *ListEntry

MoveToFront ... moves element e to the front of list l. If e is not an element of l, the list is not modified.

func (*ListEntry) Next

func (d *ListEntry) Next() *ListEntry

Next ... returns the next list element or nil.

func (*ListEntry) Prev

func (d *ListEntry) Prev() *ListEntry

Prev ... returns the previous list element or nil.

func (*ListEntry) PushBack

func (l *ListEntry) PushBack(v *ListEntry) *ListEntry

PushBack ... inserts a new element e with value v at the back of list l and returns e.

func (*ListEntry) PushBackList

func (l *ListEntry) PushBackList(other *ListEntry)

func (*ListEntry) PushFront

func (d *ListEntry) PushFront(v *ListEntry) *ListEntry

PushFront ... inserts a new value v at the front of list l and returns e.

func (*ListEntry) PushFrontList

func (l *ListEntry) PushFrontList(other *ListEntry)

func (*ListEntry) Remove

func (d *ListEntry) Remove() *ListEntry

Remove ... Alias of Delete()

Jump to

Keyboard shortcuts

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