Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AtomicMap ¶
type AtomicMap[K comparable, V any] struct { // contains filtered or unexported fields }
mmap is a struct that protects a standard library map with a mutex. All functions of mmap are thead-safe map operations.
Mmap exists as an alternative to sync.Map as a datastructure that does not necessarily require an allocation for each of its elements. Sync.Map always requires an allocation for each element inserted into it.
func (*AtomicMap[K, V]) Clear ¶
func (m *AtomicMap[K, V]) Clear()
Clear is a function that removes all elements from the map.
func (*AtomicMap[K, V]) LoadOrStore ¶
LoadOrStore is a function that atomically checks for the existence of a givne key within the map and adds the given value if the key was not found. The existing value is returned in the case that the key was found in the map, or the new value is returned in the case that the key was not found within the map. The returned boolean is true when the given key was found within the map.
type Bag ¶
type Bag[T any] struct { // contains filtered or unexported fields }
Bag is a type that holds values of T. Values can be added to the Bag and enumerated. However values can not be indexed or removed from the bag. The methods on Bag are thread safe. A zero value Bag can be used without initialization.