Documentation
¶
Overview ¶
Package nativebind selects native bindings once, when a schema is built.
Index ¶
- func GenerateFields(w io.Writer, name, typ string, fields []FieldSpec)
- func Layout(t reflect.Type, fields *Struct, direct bool) *values.NativeLayout
- func Load(t reflect.Type, p unsafe.Pointer) values.Value
- func Store(t reflect.Type, p unsafe.Pointer, x values.Value)
- type Field
- type FieldSpec
- type GeneratedField
- type GeneratedFields
- type Mode
- type Struct
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateFields ¶
GenerateFields emits native operations using direct, typed Go expressions. Callers supply imports for nativebind, values, reflect, unsafe and field types. Both evmbind and record generators use this emitter.
func Layout ¶
Layout describes native memory for a reflected or generated field binding. The operations are also used for native addresses retained by EVM.
Types ¶
type Field ¶
type Field struct {
Name string
Type reflect.Type
Offset uintptr
Get func(unsafe.Pointer) values.Value
Set func(unsafe.Pointer, values.Value)
}
Field accesses a field of a live Go struct. The owner pointer must refer to the registered Go type and remain alive for the operation. Structs, arrays, maps and slices are borrowed by address; pointers retain their native target. Scalar and string values use the ordinary values.Value representation.
type FieldSpec ¶
FieldSpec describes one exported native Go field to the shared generator. Type is its Go source spelling in the generated file's import environment.
type GeneratedField ¶
type GeneratedFields ¶
type GeneratedFields struct {
Type reflect.Type
New func() unsafe.Pointer
Fields []GeneratedField
}
GeneratedFields is emitted alongside evmbind wrappers or KVO codecs. Type and the complete exposed field list are checked once during registration.
type Struct ¶
type Struct struct {
Type reflect.Type
Fields []Field
New func() unsafe.Pointer
Generated bool
// contains filtered or unexported fields
}
Struct is an immutable native field binding. It is independent of KVO property numbers, VM memory layouts and the lifetime of any one object.
func BindFields ¶
func BindFields(t reflect.Type, generated *GeneratedFields, mode Mode) *Struct