Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Map ¶
type Map[K comparable, V any] struct { // contains filtered or unexported fields }
A Map is a map of a string to a generified value which is locked for safe access from multiple threads. It is effectively a generic version of Golang's standard library sync.Map. Admittedly, that has optimizations for multithreading performance that we do not here; thus, Map should not be used in truly performance sensitive areas, but places where code cleanliness is more important than raw performance. Map must always be passed by reference, not by value, to ensure thread safety is maintained.
func (*Map[K, V]) Get ¶
Get retrieves an entry from the map. Semantic match Golang map semantics - the bool represents whether the key exists, and the empty value of T will be returned if the key does not exist.
func (*Map[K, V]) ToMap ¶
func (m *Map[K, V]) ToMap() map[K]V
ToMap returns a shallow copy of the underlying data of the Map.
func (*Map[K, V]) Underlying ¶
func (m *Map[K, V]) Underlying() map[K]V
Underlying returns a reference to the underlying storage of the Map. Once Underlying has been called, the Map is NO LONGER THREAD SAFE. If thread safety is still required, the shallow-copy offered by ToMap() should be used instead.