unsafe

package
v0.0.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bytes2Str

func Bytes2Str(b []byte) (s string)

func IfcValuePtr

func IfcValuePtr(v interface{}) unsafe.Pointer

IfcValuePtr extracts the underlying values pointer from an empty interface{} value. Note: this might beome more unsafe in future go-versions, if primitive values < pointer size will be stored by value in the `interface{}` type.

func ReflValuePtr

func ReflValuePtr(v reflect.Value) unsafe.Pointer

ReflValuePtr extracts the pointer value from a reflect.Value instance. With reflect.Value basically being similar to `interface{}` augmented with additional flags to execute checks, we map the value into an empty interface value (no methods) and extract the actual values pointer. Note: this might beome more unsafe in future go-versions, if primitive values < pointer size will be stored by value in the `interface{}` type.

func Str2Bytes

func Str2Bytes(s string) (b []byte)

func UnsafeFnPtr

func UnsafeFnPtr(fn interface{}) unsafe.Pointer

Returns a newly (allocated on heap) function pointer. The unsafe.Pointer returned can be used to cast a function type into a function with other(compatible) type (e.g. passing pointers only).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL