Documentation
¶
Overview ¶
Package maps implements Go's builtin map type.
Index ¶
- Constants
- type Iter
- type Map
- func (m *Map) Clear(typ *abi.MapType)
- func (m *Map) Clone(typ *abi.MapType) *Map
- func (m *Map) Delete(typ *abi.MapType, key unsafe.Pointer)
- func (m *Map) Get(typ *abi.MapType, key unsafe.Pointer) (unsafe.Pointer, bool)
- func (m *Map) Put(typ *abi.MapType, key, elem unsafe.Pointer)
- func (m *Map) PutSlot(typ *abi.MapType, key unsafe.Pointer) unsafe.Pointer
- func (m *Map) Used() uint64
Constants ¶
const Use64BitHash = goarch.PtrSize == 8 && goarch.IsWasm == 0
Use 64-bit hash on 64-bit systems, except on Wasm, where we use 32-bit hash (see runtime/hash32.go).
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Iter ¶
type Iter struct {
// contains filtered or unexported fields
}
func (*Iter) Elem ¶
Elem returns a pointer to the current element. nil indicates end of iteration.
Must not be called prior to Next.
func (*Iter) Initialized ¶
func (*Iter) Key ¶
Key returns a pointer to the current key. nil indicates end of iteration.
Must not be called prior to Next.
func (*Iter) Next ¶
func (it *Iter) Next()
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.
type Map ¶
type Map struct {
// contains filtered or unexported fields
}
Note: changes here must be reflected in cmd/compile/internal/reflectdata/map.go:MapType.
func NewEmptyMap ¶
func NewEmptyMap() *Map
func NewMap ¶
If m is non-nil, it should be used rather than allocating.
maxAlloc should be runtime.maxAlloc.
TODO(prattmic): Put maxAlloc somewhere accessible.
func (*Map) Get ¶
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.