types

package
v0.0.0-...-fd2add7 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2016 License: Apache-2.0 Imports: 10 Imported by: 4

Documentation

Overview

Package types implements the runtime type system

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LookupValue

func LookupValue(r interface{}) string

func RegisterFunc

func RegisterFunc(fn interface{})

RegisterFunc ...

func RegisterValue

func RegisterValue(r interface{})

RegisterValue registers the type of x with the type table. Types need to be registered before values can be imported.

Types

type FuncID

type FuncID int32

FuncID uniquely represents a method in the context of an interface type

type TypeChar

type TypeChar struct {
	ID TypeID

	Type reflect.Type         // Go type of the receiver
	Func map[FuncID]*funcChar // Public methods
	Proc map[string]*funcChar
	// contains filtered or unexported fields
}

TypeChar reflects on the methods of a Go type, and maintains exportable IDs for its methods

func (*TypeChar) FuncWithID

func (t *TypeChar) FuncWithID(id FuncID) *funcChar

func (*TypeChar) MainID

func (t *TypeChar) MainID() FuncID

MainID returns the ID of the first method in Func. It is useful for types that have exactly one method.

func (*TypeChar) Name

func (t *TypeChar) Name() string

Name returns the canonical name of this circuit type

func (*TypeChar) New

func (t *TypeChar) New() reflect.Value

New returns a Value representing a pointer to a new zero value for the underlying type.

func (*TypeChar) Zero

func (t *TypeChar) Zero() reflect.Value

Zero returns a new zero value of the underlying type

type TypeID

type TypeID uint64

TypeID is a handle for a type

type TypeTabl

type TypeTabl struct {
	// contains filtered or unexported fields
}

TypeTabl assigns universal IDs to local, Go runtime types. These IDs are purely a function of the type's package path and name, thereby enabling interoperability between compatible but different binaries of the underlying Go code.

var (
	ValueTabl *TypeTabl = makeTypeTabl() // Type table for values
	FuncTabl  *TypeTabl = makeTypeTabl() // Type table for functions
)

func (*TypeTabl) Add

func (tt *TypeTabl) Add(t *TypeChar)

func (*TypeTabl) TypeOf

func (tt *TypeTabl) TypeOf(x interface{}) *TypeChar

func (*TypeTabl) TypeWithID

func (tt *TypeTabl) TypeWithID(id TypeID) *TypeChar

Jump to

Keyboard shortcuts

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