Documentation ¶
Overview ¶
Package unsafeheader contains header declarations copied from Go's runtime.
Index ¶
- func BytesToString(b []byte) string
- func SliceData[T any](slice []T) unsafe.Pointer
- func StringData(str string) unsafe.Pointer
- func StringToBytes(s string) []byte
- func ToRType(t reflect.Type) unsafe.Pointer
- func ToReflectType(rtype unsafe.Pointer) reflect.Type
- type Eface
- type Iface
- type SliceHeader
- type StringHeader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BytesToString ¶
func SliceData ¶ added in v2.12.0
SliceData returns a pointer to the underlying array of the argument slice.
- If len(slice) == 0, it returns nil.
- Otherwise, it returns the underlying pointer.
func StringData ¶ added in v2.12.0
StringData returns a pointer to the underlying bytes of str.
- If str == "", it returns nil.
- Otherwise, it returns the underlying pointer.
func StringToBytes ¶
func ToRType ¶ added in v2.12.0
ToRType gets the underlying [*reflect.rtype] from a reflect.Type.
func ToReflectType ¶ added in v2.12.0
ToReflectType convert an [*reflect.rtype] pointer to a reflect.Type value. It is the reverse operation of ToRType.
Types ¶
type Eface ¶ added in v2.12.0
Eface is the header for an empty interface{} value. It is a copy type of [runtime.eface].
type Iface ¶ added in v2.12.0
Iface is the header of a non-empty interface value. It is a copy type of [runtime.iface].
type SliceHeader ¶ added in v2.12.0
SliceHeader is the runtime representation of a slice.
Unlike reflect.SliceHeader, its Data field is sufficient to guarantee the data it references will not be garbage collected.
type StringHeader ¶ added in v2.12.0
StringHeader is the runtime representation of a string.
Unlike reflect.StringHeader, its Data field is sufficient to guarantee the data it references will not be garbage collected.