atomic

package
v7.7.2 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapAllF

func MapAllF[K comparable, V any, U any](m *Map[K, V], f func(map[K]V) U) U

Types

type Map

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

Map implements a Map with atomic semantics.

func New

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

New generates a new Map instance.

func (*Map[K, V]) Clone

func (m *Map[K, V]) Clone() map[K]V

Length returns the Map size.

func (*Map[K, V]) Delete

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

Delete will remove the key and return its value.

func (*Map[K, V]) DeleteAll

func (m *Map[K, V]) DeleteAll(ks ...K)

DeleteAllDeref will dereferences and removes the keys.

func (*Map[K, V]) DeleteAllDeref

func (m *Map[K, V]) DeleteAllDeref(ks ...*K)

DeleteAll will remove the keys.

func (*Map[K, V]) DeleteDeref

func (m *Map[K, V]) DeleteDeref(k *K) V

DeleteDeref will dereference and remove the key and return its value.

func (*Map[K, V]) Get

func (m *Map[K, V]) Get(k K) V

Get atomically retrieves an element from the Map.

func (*Map[K, V]) Length

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

Length returns the Map size.

func (*Map[K, V]) Replace

func (m *Map[K, V]) Replace(nm map[K]V)

Replace replaces the internal map with the provided one.

func (*Map[K, V]) Set

func (m *Map[K, V]) Set(k K, v V)

Set atomically sets an element in the Map. If idx is out of range, it will return an error.

Jump to

Keyboard shortcuts

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