rwmap

package
v0.0.0-...-63027bd Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2025 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RWMap

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

func New

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

func (*RWMap[K, V]) Clear

func (m *RWMap[K, V]) Clear()

Clear removes all items from the map.

func (*RWMap[K, V]) Copy

func (m *RWMap[K, V]) Copy() *RWMap[K, V]

Copy returns a shallow copy of the map.

func (*RWMap[K, V]) Delete

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

Delete deletes the value associated with the given key locking until the map is available for writing.

func (*RWMap[K, V]) Get

func (m *RWMap[K, V]) Get(key K) (V, bool)

Get returns the value associated with the given key, and a bool indicating whether the key was found.

func (*RWMap[K, V]) Has

func (m *RWMap[K, V]) Has(key K) bool

Has returns true if the given key exists in the map.

func (*RWMap[K, V]) Keys

func (m *RWMap[K, V]) Keys() []K

Keys returns a slice of all keys in the map.

func (*RWMap[K, V]) Len

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

Len returns the number of items in the map.

func (*RWMap[K, V]) Set

func (m *RWMap[K, V]) Set(key K, value V)

Set sets the value associated with the given key locking until the map is available for writing.

func (*RWMap[K, V]) Values

func (m *RWMap[K, V]) Values() []V

Values returns a slice of all values in the map.

Jump to

Keyboard shortcuts

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