cmap

package
v0.0.0-...-ff598de Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2026 License: Unlicense Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bucket

type Bucket[K comparable, V any] struct {
	sync.RWMutex
	Map map[K]V
	// contains filtered or unexported fields
}

type Entry

type Entry[K comparable, V any] struct {
	Key    K
	Bucket *Bucket[K, V]
}

func (Entry[K, V]) Delete

func (e Entry[K, V]) Delete()

func (Entry[K, V]) Get

func (e Entry[K, V]) Get() (V, bool)

func (Entry[K, V]) GetOrCompute

func (e Entry[K, V]) GetOrCompute(constructor func() (V, error)) (V, bool, error)

func (Entry[K, V]) Set

func (e Entry[K, V]) Set(value V)

type Map

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

func New

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

func (*Map[K, V]) ApproxLen

func (cm *Map[K, V]) ApproxLen() int

func (Map[K, V]) Contains

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

func (*Map[K, V]) Delete

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

func (*Map[K, V]) Entry

func (cm *Map[K, V]) Entry(key K) Entry[K, V]

func (Map[K, V]) Get

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

func (*Map[K, V]) GetOrCompute

func (m *Map[K, V]) GetOrCompute(key K, constructor func() (V, error)) (V, bool, error)

func (*Map[K, V]) Set

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

Jump to

Keyboard shortcuts

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