MCPcopy Create free account
hub / github.com/benbjohnson/immutable / Set

Method Set

immutable.go:743–745  ·  view source on GitHub ↗

Set returns a map with the key set to the new value. A nil value is allowed. This function will return a new map even if the updated value is the same as the existing value because Map does not track value equality.

(key K, value V)

Source from the content-addressed store, hash-verified

741// This function will return a new map even if the updated value is the same as
742// the existing value because Map does not track value equality.
743func (m *Map[K, V]) Set(key K, value V) *Map[K, V] {
744 return m.set(key, value, false)
745}
746
747func (m *Map[K, V]) set(key K, value V, mutable bool) *Map[K, V] {
748 // Set a hasher on the first value if one does not already exist.

Callers

nothing calls this directly

Calls 3

setMethod · 0.95
assertFunction · 0.85
setMethod · 0.65

Tested by

no test coverage detected