Imports #
"internal/goarch"
"internal/unsafeheader"
"unsafe"
"internal/abi"
"unsafe"
"internal/abi"
"internal/goarch"
"internal/unsafeheader"
"runtime"
"unsafe"
"internal/goarch"
"internal/unsafeheader"
"unsafe"
"internal/abi"
"unsafe"
"internal/abi"
"internal/goarch"
"internal/unsafeheader"
"runtime"
"unsafe"
Import-and-export these constants as necessary
const Interface = abi.Interface
const Ptr = abi.Pointer
const Slice = abi.Slice
const String = abi.String
const Struct = abi.Struct
var dummy struct{...}
const flagAddr flag = *ast.BinaryExpr
const flagEmbedRO flag = *ast.BinaryExpr
const flagIndir flag = *ast.BinaryExpr
const flagKindMask flag = *ast.BinaryExpr
const flagKindWidth = 5
const flagMethod flag = *ast.BinaryExpr
const flagMethodShift = 10
const flagRO flag = *ast.BinaryExpr
const flagStickyRO flag = *ast.BinaryExpr
A Kind represents the specific kind of type that a Type represents. The zero Kind is not a valid kind.
type Kind abi.Kind
arrayType represents a fixed array type.
type arrayType abi.ArrayType
chanType represents a channel type.
type chanType abi.ChanType
type flag uintptr
type funcType abi.FuncType
type interfaceType abi.InterfaceType
type nameOff abi.NameOff
ptrType represents a pointer type.
type ptrType abi.PtrType
sliceType represents a slice type.
type sliceType abi.SliceType
structType represents a struct type.
type structType abi.StructType
type textOff abi.TextOff
type typeOff abi.TypeOff
uncommonType is present only for defined types or types with methods (if T is a defined type, the uncommonTypes for T and *T have methods). Using a pointer to this struct reduces the overall size required to describe a non-defined type with no methods.
type uncommonType abi.UncommonType
Type is the representation of a Go type. Not all methods apply to all kinds of types. Restrictions, if any, are noted in the documentation for each method. Use the Kind method to find out the kind of type before calling kind-specific methods. Calling a method inappropriate to the kind of type causes a run-time panic. Type values are comparable, such as with the == operator, so they can be used as map keys. Two Type values are equal if they represent identical types.
type Type interface {
Name() string
PkgPath() string
Size() uintptr
Kind() Kind
Implements(u Type) bool
AssignableTo(u Type) bool
Comparable() bool
String() string
Elem() Type
common() *abi.Type
uncommon() *uncommonType
}
Value is the reflection interface to a Go value.
Not all methods apply to all kinds of values. Restrictions,
if any, are noted in the documentation for each method.
Use the Kind method to find out the kind of value before
calling kind-specific methods. Calling a method
inappropriate to the kind of type causes a run time panic.
The zero Value represents no value.
Its IsValid method returns false, its Kind method returns Invalid,
its String method returns "
type Value struct {
typ_ *abi.Type
ptr unsafe.Pointer
flag
}
A ValueError occurs when a Value method is invoked on a Value that does not support it. Such cases are documented in the description of each method.
type ValueError struct {
Method string
Kind Kind
}
name is an encoded type name with optional extra data. The first byte is a bit field containing: 1<<0 the name is exported 1<<1 tag data follows the name 1<<2 pkgPath nameOff follows the name and tag The next two bytes are the data length: l := uint16(data[1])<<8 | uint16(data[2]) Bytes [3:3+l] are the string data. If tag data follows then bytes 3+l and 3+l+1 are the tag length, with the data following. If the import path follows, then 4 bytes at the end of the data form a nameOff. The import path is only set for concrete methods that are defined in a different package than their type. If a name starts with "*", then the exported bit represents whether the pointed to type is exported.
type name struct {
bytes *byte
}
type rtype struct {
*abi.Type
}
func (t rtype) AssignableTo(u Type) bool
CanSet reports whether the value of v can be changed. A Value can be changed only if it is addressable and was not obtained by the use of unexported struct fields. If CanSet returns false, calling Set or any type-specific setter (e.g., SetBool, SetInt) will panic.
func (v Value) CanSet() bool
func (t rtype) Comparable() bool
Elem returns the value that the interface v contains or that the pointer v points to. It panics if v's Kind is not Interface or Pointer. It returns the zero Value if v is nil.
func (v Value) Elem() Value
func (t rtype) Elem() Type
func (e *ValueError) Error() string
func (t rtype) Implements(u Type) bool
func (t rtype) In(i int) Type
IsNil reports whether its argument v is nil. The argument must be a chan, func, interface, map, pointer, or slice value; if it is not, IsNil panics. Note that IsNil is not always equivalent to a regular comparison with nil in Go. For example, if v was created by calling ValueOf with an uninitialized interface variable i, i==nil will be true but v.IsNil will panic as v will be the zero Value.
func (v Value) IsNil() bool
IsValid reports whether v represents a value. It returns false if v is the zero Value. If IsValid returns false, all other methods except String panic. Most functions and methods never return an invalid Value. If one does, its documentation states the conditions explicitly.
func (v Value) IsValid() bool
func (t rtype) Key() Type
Kind returns v's Kind. If v is the zero Value (IsValid returns false), Kind returns Invalid.
func (v Value) Kind() Kind
Len returns v's length. It panics if v's Kind is not Array, Chan, Map, Slice, or String.
func (v Value) Len() int
func (t rtype) Len() int
func (t rtype) Name() string
func (t rtype) NumField() int
func (t rtype) NumIn() int
func (t rtype) NumMethod() int
func (t rtype) NumOut() int
func (t rtype) Out(i int) Type
func (t rtype) PkgPath() string
Set assigns x to the value v. It panics if CanSet returns false. As in Go, x's value must be assignable to v's type.
func (v Value) Set(x Value)
func (t rtype) String() string
Swapper returns a function that swaps the elements in the provided slice. Swapper panics if the provided interface is not a slice.
func Swapper(slice any) (func(i int, j int))
Type returns v's type.
func (v Value) Type() Type
TypeOf returns the reflection Type that represents the dynamic type of i. If i is a nil interface value, TypeOf returns nil.
func TypeOf(i any) Type
ValueOf returns a new Value initialized to the concrete value stored in the interface i. ValueOf(nil) returns the zero Value.
func ValueOf(i any) Value
add returns p+x. The whySafe string is ignored, so that the function still inlines as efficiently as p+x, but all call sites should use the string to record why the addition is safe, which is to say why the addition does not cause x to advance to the very end of p's allocation and therefore point incorrectly at the next block in memory.
func add(p unsafe.Pointer, x uintptr, whySafe string) unsafe.Pointer
arrayAt returns the i-th element of p, an array whose elements are eltSize bytes wide. The array pointed at by p must have at least i+1 elements: it is invalid (but impossible to check here) to pass i >= len, because then the result will point outside the array. whySafe must explain why i < len. (Passing "i < len" is fine; the benefit is to surface this assumption at the call site.)
func arrayAt(p unsafe.Pointer, i int, eltSize uintptr, whySafe string) unsafe.Pointer
assignTo returns a value v that can be assigned directly to typ. It panics if v is not assignable to typ. For a conversion to an interface type, target is a suggested scratch space to use.
func (v Value) assignTo(context string, dst *abi.Type, target unsafe.Pointer) Value
go:noescape
func chanlen(unsafe.Pointer) int
func (t rtype) common() *abi.Type
func (n name) data(off int, whySafe string) *byte
directlyAssignable reports whether a value x of type V can be directly assigned (using memmove) to a value of type T. https://golang.org/doc/go_spec.html#Assignability Ignoring the interface rules (implemented elsewhere) and the ideal constant rules (no ideal constants at run time).
func directlyAssignable(T *abi.Type, V *abi.Type) bool
func elem(t *abi.Type) *abi.Type
func (n name) embedded() bool
Dummy annotation marking that the value x escapes, for use in cases where the reflect code is so clever that the compiler cannot follow.
func escapes(x any)
func (t rtype) exportedMethods() []abi.Method
func (n name) hasTag() bool
func haveIdenticalType(T *abi.Type, V *abi.Type, cmpTags bool) bool
func haveIdenticalUnderlyingType(T *abi.Type, V *abi.Type, cmpTags bool) bool
func ifaceE2I(t *abi.Type, src any, dst unsafe.Pointer)
implements reports whether the type V implements the interface type T.
func implements(T *abi.Type, V *abi.Type) bool
func (n name) isExported() bool
func (f flag) kind() Kind
go:noescape
func maplen(unsafe.Pointer) int
methodName returns the name of the calling method, assumed to be two stack frames above.
func methodName() string
mustBeAssignable panics if f records that the value is not assignable, which is to say that either it was obtained using an unexported field or it is not addressable.
func (f flag) mustBeAssignable()
mustBeExported panics if f records that the value was obtained using an unexported field.
func (f flag) mustBeExported()
func (n name) name() string
func (t rtype) nameOff(off nameOff) abi.Name
NumMethod returns the number of exported methods in the value's method set.
func (v Value) numMethod() int
packEface converts v to the empty interface.
func packEface(v Value) any
func pkgPath(n abi.Name) string
pointer returns the underlying pointer represented by v. v.Kind() must be Pointer, Map, Chan, Func, or UnsafePointer
func (v Value) pointer() unsafe.Pointer
readVarint parses a varint as encoded by encoding/binary. It returns the number of encoded bytes and the encoded value.
func (n name) readVarint(off int) (int, int)
resolveNameOff resolves a name offset from a base pointer. The (*rtype).nameOff method is a convenience wrapper for this function. Implemented in the runtime package. go:noescape
func resolveNameOff(ptrInModule unsafe.Pointer, off int32) unsafe.Pointer
resolveTypeOff resolves an *rtype offset from a base type. The (*rtype).typeOff method is a convenience wrapper for this function. Implemented in the runtime package. go:noescape
func resolveTypeOff(rtype unsafe.Pointer, off int32) unsafe.Pointer
func (f flag) ro() flag
func (n name) tag() string
func toRType(t *abi.Type) rtype
toType converts from a *rtype to a Type that can be returned to the client of package reflect. In gc, the only concern is that a nil *rtype must be replaced by a nil Type, but in gccgo this function takes care of ensuring that multiple *rtype for the same type are coalesced into a single Type.
func toType(t *abi.Type) Type
func (v Value) typ() *abi.Type
func (t rtype) typeOff(off typeOff) *abi.Type
typedmemmove copies a value of type t to dst from src. go:noescape
func typedmemmove(t *abi.Type, dst unsafe.Pointer, src unsafe.Pointer)
func (t rtype) uncommon() *uncommonType
unpackEface converts the empty interface i to a Value.
func unpackEface(i any) Value
go:noescape
func unsafe_New(*abi.Type) unsafe.Pointer
func valueInterface(v Value) any
Generated with Arrow