maps package - internal/runtime/maps - Go Packages

Package maps implements Go's builtin map type.

Use 64-bit hash on 64-bit systems, except on Wasm, where we use 32-bit hash (see runtime/hash32.go).

This section is empty.

This section is empty.

Elem returns a pointer to the current element. nil indicates end of iteration.

Must not be called prior to Next.

Init initializes Iter for iteration.

func (it *Iter) Initialized() bool

Key returns a pointer to the current key. nil indicates end of iteration.

Must not be called prior to Next.

func (it *Iter) Map() *Map

Map returns the map this iterator is iterating over.

Next proceeds to the next element in iteration, which can be accessed via the Key and Elem methods.

The table can be mutated during iteration, though there is no guarantee that the mutations will be visible to the iteration.

Init must be called prior to Next.

Note: changes here must be reflected in cmd/compile/internal/reflectdata/map.go:MapType.

If m is non-nil, it should be used rather than allocating.

maxAlloc should be runtime.maxAlloc.

TODO(prattmic): Put maxAlloc somewhere accessible.

Clear deletes all entries from the map resulting in an empty map.

Get performs a lookup of the key that key points to. It returns a pointer to the element, or false if the key doesn't exist.

PutSlot returns a pointer to the element slot where an inserted element should be written.

PutSlot never returns nil.