safemap

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2022 License: GPL-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 SafeMap

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

SafeMap provides a map alternative to avoid memory leak. This implementation is not needed until issue below fixed. https://github.com/golang/go/issues/20135

func NewSafeMap

func NewSafeMap[V any]() *SafeMap[V]

NewSafeMap returns a SafeMap.

func (*SafeMap[V]) Del

func (m *SafeMap[V]) Del(key any)

Del deletes the object with the given key from m.

func (*SafeMap[V]) Get

func (m *SafeMap[V]) Get(key any) (V, bool)

Get gets the object with the given key from m.

func (*SafeMap[V]) Range added in v0.1.1

func (m *SafeMap[V]) Range(f func(key any, value V) bool)

Range calls f sequentially for each key and value present in the map.

func (*SafeMap[V]) Set

func (m *SafeMap[V]) Set(key any, value V)

Set sets the object into m with the given key.

func (*SafeMap[V]) Size

func (m *SafeMap[V]) Size() int

Size returns the size of m.

Jump to

Keyboard shortcuts

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