defs

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IntSize   = 4 << (^uint(0) >> 63)
	StackSize = 1024
)

Variables

This section is empty.

Functions

func GetDefaultInitializer

func GetDefaultInitializer(vt reflect.Type) (unsafe.Pointer, error)

func GetSize

func GetSize(vt reflect.Type) int

Types

type DefaultInitializer

type DefaultInitializer interface {
	InitDefault()
}

type Field

type Field struct {
	F       int
	ID      uint16
	Type    *Type
	Opts    Options
	Spec    Requiredness
	Default reflect.Value
}

func DoResolveFields

func DoResolveFields(vt reflect.Type) ([]Field, error)

DoResolveFields ... no cache, use ResolveFields instead. it's only used by reflect pkg for less objects, coz reflect pkg has its own cache.

func ResolveFields

func ResolveFields(vt reflect.Type) ([]Field, error)

type Options

type Options uint8
const (
	NoCopy Options = 1 << iota
)

func (Options) String

func (self Options) String() string

type Requiredness

type Requiredness uint8
const (
	Default Requiredness = iota
	Required
	Optional
)

func (Requiredness) String

func (self Requiredness) String() string

type SyntaxError

type SyntaxError struct {
	Pos    int
	Src    string
	Reason string
}

func ESetList

func ESetList(pos int, src string, vt reflect.Type) SyntaxError

func ESyntax

func ESyntax(pos int, src string, reason string) SyntaxError

func (SyntaxError) Error

func (self SyntaxError) Error() string

type Tag

type Tag uint8
const (
	T_bool    Tag = 2
	T_i8      Tag = 3
	T_double  Tag = 4
	T_i16     Tag = 6
	T_i32     Tag = 8
	T_i64     Tag = 10
	T_string  Tag = 11
	T_struct  Tag = 12
	T_map     Tag = 13
	T_set     Tag = 14
	T_list    Tag = 15
	T_enum    Tag = 0x80
	T_binary  Tag = 0x81
	T_pointer Tag = 0x82
)

func T_int

func T_int() Tag

func (Tag) IsWireTag

func (self Tag) IsWireTag() bool

type Type

type Type struct {
	T Tag
	K *Type
	V *Type
	S reflect.Type
}

func ParseType

func ParseType(vt reflect.Type, def string) (*Type, error)

func (*Type) Free

func (self *Type) Free()

func (*Type) IsEnum added in v0.2.1

func (self *Type) IsEnum() bool

func (*Type) IsKeyType

func (self *Type) IsKeyType() bool

func (*Type) IsSimpleType

func (self *Type) IsSimpleType() bool

func (*Type) IsValueType

func (self *Type) IsValueType() bool

func (*Type) String

func (self *Type) String() string

func (*Type) Tag

func (self *Type) Tag() Tag

type TypeError

type TypeError struct {
	Note string
	Type reflect.Type
}

func EType

func EType(vt reflect.Type, note string) TypeError

func EUseOther

func EUseOther(vt reflect.Type, alt string) TypeError

func (TypeError) Error

func (self TypeError) Error() string

Jump to

Keyboard shortcuts

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