package
Version:
v0.3.0
Opens a new window with list of versions in this module.
Published: Jul 21, 2025
License: Apache-2.0
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
Package sync provides utilities for synchronization.
-
type Map
-
func (sm *Map[K, V]) Delete(k K)
-
func (sm *Map[K, V]) Empty() bool
-
func (sm *Map[K, V]) Iter() func(func(K, V) bool)
-
func (sm *Map[K, V]) Load(k K) (v V)
-
func (sm *Map[K, V]) LoadAndDelete(k K) (any, bool)
-
func (sm *Map[K, V]) Size() (i int)
-
func (sm *Map[K, V]) Store(k K, v V)
Map is a generic synchronized map. It is a wrapper around Go's standard
sync.Map, with all the same caveats.
func (sm *Map[K, V]) Delete(k K)
Delete removes a pair given a key.
Empty returns true if the map is empty.
func (sm *Map[K, V]) Iter() func(func(K, V) bool)
Iter returns an iterator to range over the elements of the map.
func (sm *Map[K, V]) Load(k K) (v V)
Load returns a value given a key.
func (sm *Map[K, V]) LoadAndDelete(k K) (any, bool)
LoadAndDelete deletes the value for a key, returning the previous value (if any) and whether the key was present.
func (sm *Map[K, V]) Size() (i int)
Size returns the number of elements in the map. This takes O(n) time.
func (sm *Map[K, V]) Store(k K, v V)
Store a key,value pair.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.