github.com/hamba/slices@v0.2.1-0.20220316050741-75c057d92699/ptr.go (about) 1 package slices 2 3 import "unsafe" 4 5 type eface struct { 6 _ unsafe.Pointer 7 data unsafe.Pointer 8 } 9 10 func ptrOf(obj interface{}) unsafe.Pointer { 11 return (*eface)(unsafe.Pointer(&obj)).data 12 } 13 14 //go:linkname noescape runtime.noescape 15 //go:noescape 16 func noescape(p unsafe.Pointer) unsafe.Pointer