aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/modern-go/reflect2/go_above_118.go
blob: 2b4116f6c9bec1320b5bfffd1e8fa2b23228b29d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//+build go1.18

package reflect2

import (
	"unsafe"
)

// m escapes into the return value, but the caller of mapiterinit
// doesn't let the return value escape.
//go:noescape
//go:linkname mapiterinit reflect.mapiterinit
func mapiterinit(rtype unsafe.Pointer, m unsafe.Pointer, it *hiter)

func (type2 *UnsafeMapType) UnsafeIterate(obj unsafe.Pointer) MapIterator {
	var it hiter
	mapiterinit(type2.rtype, *(*unsafe.Pointer)(obj), &it)
	return &UnsafeMapIterator{
		hiter:      &it,
		pKeyRType:  type2.pKeyRType,
		pElemRType: type2.pElemRType,
	}
}