safemap

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SafeMap

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

SafeMap is a thread-safe wrapper over a generic map[k]V.

func New

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

New returns a pointer to a new instance of SafeMap.

func (*SafeMap[K, V]) Delete

func (s *SafeMap[K, V]) Delete(key K)

Delete a value from the SafeMap.

func (*SafeMap[K, V]) Get

func (s *SafeMap[K, V]) Get(key K) (V, bool)

Get a value from the SafeMap.

func (*SafeMap[K, V]) Len

func (s *SafeMap[K, V]) Len() int

Return the number of items in the SafeMap.

func (*SafeMap[K, V]) Set

func (s *SafeMap[K, V]) Set(key K, value V)

Set a value in the SafeMap.

Jump to

Keyboard shortcuts

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