Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dict ¶
type Dict[TKey comparable, TValue any] interface { collection.Collection[Pair[TKey, TValue]] // Unmarshal returns the underlying Go map Unmarshal() map[TKey]TValue // Get returns the value associated with // the given key if it exists, otherwise nil Get(TKey) *TValue // Set assigns the given value with the given // key, overwriting an existing value if it // exists Set(TKey, TValue) // Remove removes the key-value pair associated // with the given key, returning the previous value // if it exists, otherwise nil Remove(TKey) *TValue }
Dict provides an associative array of key-value pairs, based on the primitive Go map
func From ¶
func From[TKey comparable, TValue any]( c collection.Collection[Pair[TKey, TValue]], ) Dict[TKey, TValue]
From creates a new Dict by concatenating the items of the given collection
func Marshal ¶
func Marshal[TKey comparable, TValue any]( m map[TKey]TValue, ) Dict[TKey, TValue]
func New ¶
func New[TKey comparable, TValue any]() Dict[TKey, TValue]
New creates a new Dict with an arbitrary initial size
type Pair ¶
type Pair[TKey comparable, TValue any] struct { Key TKey Value TValue }
Pair represents a key-value pair in a Dict
Click to show internal directories.
Click to hide internal directories.