Documentation
¶
Index ¶
- type Entry
- type Heap
- func (h *Heap[I, V]) First() *Entry[I, V]
- func (h *Heap[I, V]) Get(id ids.ID) (*Entry[I, V], bool)
- func (h *Heap[I, V]) Has(id ids.ID) bool
- func (h *Heap[I, V]) Items() []*Entry[I, V]
- func (h *Heap[I, V]) Len() int
- func (h *Heap[I, V]) Pop() *Entry[I, V]
- func (h *Heap[I, V]) Push(e *Entry[I, V])
- func (h *Heap[I, V]) Remove(index int) *Entry[I, V]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Heap ¶
type Heap[I any, V constraints.Ordered] struct { // contains filtered or unexported fields }
Heap[I,V] is used to track objects of [I] by [Val].
This data structure does not perform any synchronization and is not safe to use concurrently without external locking.
func (*Heap[I, V]) First ¶
First returns the first item in the heap. This is the smallest item in a minHeap and the largest item in a maxHeap.
If no items are in the heap, it will return nil.
func (*Heap[I, V]) Get ¶
Get returns the entry in th associated with [id], and a bool if [id] was found in th.
func (*Heap[I, V]) Items ¶
Items returns all items in the heap in sorted order. You should not modify the response.
func (*Heap[I, V]) Pop ¶
Pop can be called by external users to remove an object from the heap at a specific index instead of using `containers.heap`, which makes using this heap less error-prone.