rtutil

package module
v2.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2022 License: MIT Imports: 2 Imported by: 0

README

go-rtutil

Go runtime / reflect utilities (hacks). You should not use these without deep understanding! (that's probably a bold claim about my own undstanding...)

So yeah, here be dragons and all that.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRuntimeType

func GetRuntimeType(t reflect.Type) unsafe.Pointer

GetRuntimeType will fetch a pointer for the runtime._type value of the originating object this reflect.Type represents. This is possible because the reflect package returns the value of an interface{}'s Eface.Type cast as their copy of runtime._type. So the Eface.Data value for this reflected type will be the underlying runtime type this was from.

Types

type Eface

type Eface struct {
	// Type is a pointer to the runtime._type.
	Type unsafe.Pointer

	// Value is a pointer to the actual data.
	Value unsafe.Pointer
}

Eface (empty interface) is the header for an interface{} value.

func ToEface

func ToEface(v interface{}) *Eface

ToEface will return the Eface header for given interface{} value.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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