syncedmap

package
v0.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 23, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package syncedmap provides a synced map.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SyncedMap

type SyncedMap[K comparable, V any] struct {
	// contains filtered or unexported fields
}

SyncedMap represents a generic hashmap that is safe for concurrent use by multiple goroutines.

func New

func New[K comparable, V any]() *SyncedMap[K, V]

New returns a new Map.

func (*SyncedMap[K, V]) All added in v0.2.3

func (sm *SyncedMap[K, V]) All() iter.Seq2[K, V]

All returns an iterator over the map. All does not necessarily correspond to any consistent snapshot of the Map's contents. For a consistent snapshot use SyncedMap.Clone.

func (*SyncedMap[K, V]) Clone added in v0.2.3

func (sm *SyncedMap[K, V]) Clone() map[K]V

Clone returns a snapshot of the map

func (*SyncedMap[K, V]) Load

func (sm *SyncedMap[K, V]) Load(key K) (V, bool)

Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.

func (*SyncedMap[K, V]) Store

func (sm *SyncedMap[K, V]) Store(key K, value V)

Store sets the value for a key.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL