Install:
go get github.com/muir/gwrap
This package is a collection of generic functions that wrap standard library functions. Hopefully, this packge will quickly become obsolete because the library functions will support generics directly. Until then, there is this.
SyncMap is a wrapper around sync.Map supporting the go 1.18 sync.Map
CompareMap is a wrapper around sync.Map supporting the go 1.20 sync.Map. CompareMap is only available when compiling with go 1.20 and above.
AtomicValue is a wrapper around sync/atomic.Value.
SyncPool is a wrapper for sync.Pool
Heap is a heap-like wrapper for container/heap
PriorityQueue is a wrapper for container/heap that implements priority queues.
PriorityQueue supports removing arbitrary items from the queue at any point. To
support that, the items in the queue must implement the PQItem
interface. The
simplest way to implement that interface is to embed PQItemEmbed
in the items
that will be in the priority queue.