collection

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2024 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 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[K comparable, V any]() *SafeMap[K, V]

NewSafeMap returns a SafeMap.

func (*SafeMap[K, V]) Del

func (m *SafeMap[K, V]) Del(key K)

Del deletes the value with the given key from m.

func (*SafeMap[K, V]) Get

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

Get gets the value with the given key from m.

func (*SafeMap[K, V]) Set

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

Set sets the value into m with the given key.

func (*SafeMap[K, V]) Size

func (m *SafeMap[K, 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