Documentation
¶
Index ¶
- func SliceMap[T any, U any](slice []T, fn func(T) U) []U
- type SafeMap
- func (m *SafeMap[K, V]) Clear()
- func (m *SafeMap[K, V]) Delete(key K)
- func (m *SafeMap[K, V]) Get(key K) (V, bool)
- func (m *SafeMap[K, V]) HasKey(key K) bool
- func (m *SafeMap[K, V]) HasValue(val V) bool
- func (m *SafeMap[K, V]) IsEmpty() bool
- func (m *SafeMap[K, V]) Iter() <-chan Tuple[K, V]
- func (m *SafeMap[K, V]) Keys() []K
- func (m *SafeMap[K, V]) Len() int
- func (m *SafeMap[K, V]) MustGet(key K) V
- func (m *SafeMap[K, V]) Set(key K, val V)
- func (m *SafeMap[K, V]) Values() []V
- type Tuple
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type SafeMap ¶
type SafeMap[K comparable, V comparable] struct { // contains filtered or unexported fields }
SafeMap is a thread-safe map.
func NewSafeMap ¶
func NewSafeMap[K comparable, V comparable](items ...Tuple[K, V]) *SafeMap[K, V]
NewSafeMap creates a new SafeMap.
func (*SafeMap[K, V]) Clear ¶ added in v0.0.15
func (m *SafeMap[K, V]) Clear()
Clear clears the map.
func (*SafeMap[K, V]) Delete ¶
func (m *SafeMap[K, V]) Delete(key K)
Delete deletes a value from the map.
func (*SafeMap[K, V]) Get ¶
Get gets a value from the map.
func (*SafeMap[K, V]) HasKey ¶ added in v0.0.15
HasKey checks if the map has the key.
func (*SafeMap[K, V]) HasValue ¶ added in v0.0.15
HasValue checks if the map has the value.
func (*SafeMap[K, V]) IsEmpty ¶ added in v0.0.15
IsEmpty checks if the map is empty.
func (*SafeMap[K, V]) Iter ¶
Iter returns a channel that iterates over the map.
func (*SafeMap[K, V]) Keys ¶ added in v0.0.15
func (m *SafeMap[K, V]) Keys() []K
Keys returns all keys in the map.
Click to show internal directories.
Click to hide internal directories.