Documentation ¶
Overview ¶
Package ringlist implements a capacity limited linked list based on ring.Ring.
Index ¶
- type List
- func (l *List) Back() *ring.Ring
- func (l *List) Do(f func(value interface{}) bool)
- func (l *List) Front() *ring.Ring
- func (l *List) Len() int
- func (l *List) Move(r *ring.Ring, delta int)
- func (l *List) MoveAfter(r, mark *ring.Ring)
- func (l *List) MoveBefore(r, mark *ring.Ring)
- func (l *List) MoveToBack(r *ring.Ring)
- func (l *List) MoveToFront(r *ring.Ring)
- func (l *List) PushBack(r *ring.Ring) (front interface{})
- func (l *List) PushFront(r *ring.Ring) (back interface{})
- func (l *List) Remove(r *ring.Ring) (value interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type List ¶
type List struct {
// contains filtered or unexported fields
}
List is a list with capacity and overflow cleanup.
func New ¶
New creates an empty list with capacity cap. When cap == 0, the list has infinite capacity.
func (*List) Do ¶
Do calls function f on each element of the list, in forward order. If f returns false, Do stops the iteration. f must not change l.
func (*List) Move ¶
Move moves element r forward or backwards by at most delta positions or until the element becomes the front or back element in the list.
func (*List) MoveBefore ¶
MoveAfter moves an element to its new position before mark.
func (*List) MoveToBack ¶
MoveToBack moves the element to the back of list l.
func (*List) MoveToFront ¶
MoveToFront moves the element to the front of list l.
func (*List) PushBack ¶
PushBack inserts an element at the back of list l. If capacity is exceeded, the front element is removed and its value returned.