Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( NoSpaceError = errors.New("No space") LessFuncNotImplemented = errors.New("Less func not implemented") )
Functions ¶
This section is empty.
Types ¶
type RingSlice ¶
type RingSlice[T any] interface { // Interface sort.Interface contain // Len() int return items num that this ring-slice already hold // Less(i, j int) bool // Swap(i, j int) sort.Interface // Get item from index, index must less than length Get(index int) T // Set item to index, index must less than length Set(index int, item T) // AppendTail append items to tail, // Notice: panic if space not enough (Cap() - Len()) < len(items) AppendTail(items ...T) // AppendHead append item to head // Notice: panic if space not enough (Cap() - Len()) < 1 AppendHead(item T) // RemoveHead remove n item from head RemoveHead(n int) // RemoveTail remove n item from tail RemoveTail(n int) // Cap returns the totla items num that this ring-slice can hold Cap() int // RestSpace return the max items num that this ring-slice can append RestSpace() int }
Click to show internal directories.
Click to hide internal directories.