gotools/gopls/internal/util/immutable/immutable.go

type Map

// MapOf wraps the given Go map.
//
// The caller must not subsequently mutate the map.
func MapOf[K comparable, V any](m map[K]V) Map[K, V] {}

// Value returns the mapped value for k.
// It is equivalent to the commaok form of an ordinary go map, and returns
// (zero, false) if the key is not present.
func (m Map[K, V]) Value(k K) (V, bool) {}

// Len returns the number of entries in the Map.
func (m Map[K, V]) Len() int {}

// Range calls f for each mapped (key, value) pair.
// There is no way to break out of the loop.
// TODO: generalize when Go iterators (#61405) land.
func (m Map[K, V]) Range(f func(k K, v V)) {}