intmap package - github.com/kelindar/intmap - Go Packages

This section is empty.

This section is empty.

This section is empty.

Map is a contiguous hash table with interleaved key/value slots.

New allocates a map sized for at least `size` entries.

New allocates a map sized for at least `size` entries.

func (m *Map) Capacity() int

Capacity returns the maximum number of entries before resize.

Clear removes all key/value pairs from the map.

func (m *Map) Clone() *Map

Clone returns a copy of the map.

func (m *Map) Count() int

Count returns number of key/value pairs in the map.

Delete removes the value for a key.

Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.

Range visits every key/value pair in the map.

func (m *Map) RangeEach(fn func(key, val uint32))

RangeEach visits every key/value pair without early‑exit capability.

RangeErr stops on the first error returned by fn and propagates it.

func (m *Map) Store(key, val uint32)

Store sets the value for a key.

Sync is a thread-safe, map-like data-structure for int64s

func NewSync(size int) *Sync

NewSync returns a thread-safe map initialized with n spaces and uses the stated fillFactor. The map will grow as needed.

func NewSyncWithFill(size int, fillFactor float64) *Sync

NewSyncWithFill returns a thread-safe map initialized with n spaces and uses the stated fillFactor. The map will grow as needed.

func (m *Sync) Count() (count int)

Count returns number of key/value pairs in the map.

Delete deletes the value for a key.

Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.

LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value returned by the handler. The loaded result is true if the value was loaded, false if stored.

Range calls f sequentially for each key and value present in the map. If f returns false, range stops the iteration.

func (m *Sync) Store(key, val uint32)

Store sets the value for a key.