syncmap

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2024 License: GPL-3.0 Imports: 2 Imported by: 0

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
}

Map is a regular map but synchronized with a mutex.

func New

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

New returns a new syncmap.

func (*Map[K, V]) All

func (m *Map[K, V]) All() iter.Seq2[K, V]

All iterates over all elements in the map

func (*Map[K, V]) Delete

func (m *Map[K, V]) Delete(key K)

Delete deletes a key.

func (*Map[K, V]) Len

func (m *Map[K, V]) Len() int

Len returns the number of elements in the map.

func (*Map[K, V]) Load

func (m *Map[K, V]) Load(key K) (V, bool)

Load returns the value for a key.

func (*Map[K, V]) Store

func (m *Map[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