Discover Packages
github.com/libtnb/cron
internal
heap
package
Version:
v0.6.0
Opens a new window with list of versions in this module.
Published: Sep 2, 2026
License: MIT
Opens a new window with license information.
Imports: 0
Opens a new window with list of imports.
Imported by: 0 modules, 0 packages
The first number is the count of modules that contain a package that imports this one.
The module count is a better indicator of popularity than the package count.
A module with 100 importing packages is counted only once instead of 100 times,
reflecting the fact that the choice to use the package was likely made only once,
not 100 times.
A '?' means that the value hasn't been computed yet.
Opens a new window with list of known importers.
Documentation
Documentation
¶
Package heap provides a typed min-heap with addressable items, so the
scheduler can re-key or remove an entry in O(log n) without searching.
type Heap[T any ] struct {
}
Heap is a min-heap keyed by int64 (the scheduler uses UnixNano). The zero
value is usable. It is not safe for concurrent use.
New returns an empty heap.
Fix changes it's key and restores heap order. Items not stored in h (never
pushed, or already popped or removed) are ignored.
Len reports the number of items.
Peek returns the minimum item without removing it; ok is false when the
heap is empty.
Pop removes and returns the minimum item; ok is false when the heap is
empty. The returned item's Index becomes -1.
Push inserts v under key and returns its item handle.
Remove deletes it from h and sets its Index to -1. Items not stored in h
are ignored.
type Item[T any ] struct {
Key int64
Value T
}
Item is a heap entry returned by Push and accepted by Fix and Remove. Key
and Value may be read at any time; change Key only through Fix.
Index reports the item's heap position, or -1 after removal.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.