Documentation
¶
Index ¶
- type Direction
- type Element
- type List
- func (l *List[T]) Back() *Element[T]
- func (l *List[T]) Len() int
- func (l *List[T]) MoveToFront(e *Element[T])
- func (l *List[T]) Next(offset int) (*Element[T], bool)
- func (l *List[T]) PrevUnlocked(offset int) (*Element[T], bool)
- func (l *List[T]) PushBack(v T) *Element[T]
- func (l *List[T]) PushFront(v T) *Element[T]
- func (l *List[T]) Remove(e *Element[T]) T
- func (l *List[T]) Sort(ord Order)
- func (l *List[T]) Walk(dir Direction, fn func(l *List[T], el *Element[T]) (shouldContinue bool))
- type Order
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Element ¶
Element is a node in the doubly linked list that holds a value of type T. Never touch fields directly outside of List methods.
type List ¶
List is a generic doubly linked list with optional thread safety.
func (*List[T]) MoveToFront ¶
MoveToFront moves e to the front of the list without removing it from memory or touching the pool.
func (*List[T]) Next ¶
Next returns the element at the given offset from the front (0-based). Returns (nil, false) if offset is out of bounds.
func (*List[T]) PrevUnlocked ¶
PrevUnlocked returns the element at the given offset from the back (0-based). Returns (nil, false) if offset is out of bounds.
func (*List[T]) PushBack ¶
PushBack inserts v at the back and returns new element. Thread-safe if guarded.
func (*List[T]) PushFront ¶
PushFront inserts v at the front and returns new element. Thread-safe if guarded.