listparam

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

package listparam wraps doubly-linked list implemented in go programming langauge standard library, to accept type parameter.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Element

type Element[T any] struct {
	// contains filtered or unexported fields
}

func (*Element[T]) Get

func (e *Element[T]) Get() (v T, ok bool)

Get returns internal Value. If internal Value is non-nil and then returns value and true. Otherwise returns zero of T and false.

func (*Element[T]) Next

func (e *Element[T]) Next() *Element[T]

func (*Element[T]) Prev

func (e *Element[T]) Prev() *Element[T]

func (*Element[T]) Set

func (e *Element[T]) Set(v T)

Set is equivalent to `element.Value = v`

func (*Element[T]) Unwrap

func (e *Element[T]) Unwrap() *list.Element

Unwrap returns internal *`container/list`.Element. Setting non-T value may cause runtime panic in succeeding Get call.

type List

type List[T any] struct {
	// contains filtered or unexported fields
}

func New

func New[T any]() *List[T]

func (*List[T]) Back

func (l *List[T]) Back() *Element[T]

func (*List[T]) Front

func (l *List[T]) Front() *Element[T]

func (*List[T]) Init

func (l *List[T]) Init() *List[T]

func (*List[T]) InsertAfter

func (l *List[T]) InsertAfter(v T, mark *Element[T]) *Element[T]

func (*List[T]) InsertBefore

func (l *List[T]) InsertBefore(v T, mark *Element[T]) *Element[T]

func (*List[T]) Len

func (l *List[T]) Len() int

func (*List[T]) MoveAfter

func (l *List[T]) MoveAfter(e, mark *Element[T])

func (*List[T]) MoveBefore

func (l *List[T]) MoveBefore(e, mark *Element[T])

func (*List[T]) MoveToBack

func (l *List[T]) MoveToBack(e *Element[T])

func (*List[T]) MoveToFront

func (l *List[T]) MoveToFront(e *Element[T])

func (*List[T]) PushBack

func (l *List[T]) PushBack(v T) *Element[T]

func (*List[T]) PushBackList

func (l *List[T]) PushBackList(other *List[T])

func (*List[T]) PushFront

func (l *List[T]) PushFront(v T) *Element[T]

func (*List[T]) PushFrontList

func (l *List[T]) PushFrontList(other *List[T])

func (*List[T]) Remove

func (l *List[T]) Remove(e *Element[T]) (v T, removed bool)

Remove calls Remove method of internal `container/list`.List. If Remove returns non-nil value then removed is true, false otherwize. When removed is false returned v is zero of T.

Jump to

Keyboard shortcuts

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