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

Method Map

immutable.go:828–833  ·  view source on GitHub ↗

Map returns the underlying map. Only call once. Builder is invalid after call. Will panic on second invocation.

()

Source from the content-addressed store, hash-verified

826// Map returns the underlying map. Only call once.
827// Builder is invalid after call. Will panic on second invocation.
828func (b *MapBuilder[K, V]) Map() *Map[K, V] {
829 assert(b.m != nil, "immutable.SortedMapBuilder.Map(): duplicate call to fetch map")
830 m := b.m
831 b.m = nil
832 return m
833}
834
835// Len returns the number of elements in the underlying map.
836func (b *MapBuilder[K, V]) Len() int {

Callers 5

BenchmarkMap_DeleteFunction · 0.80
ExampleMapBuilder_SetFunction · 0.80
ExampleMapBuilder_DeleteFunction · 0.80

Calls 1

assertFunction · 0.85

Tested by 5

BenchmarkMap_DeleteFunction · 0.64
ExampleMapBuilder_SetFunction · 0.64
ExampleMapBuilder_DeleteFunction · 0.64