github.com/goccy/go-json@v0.10.3-0.20240509105655-5e2ae3f23c1d/internal/runtime/rtype.go (about)

     1  package runtime
     2  
     3  import (
     4  	"reflect"
     5  	"unsafe"
     6  )
     7  
     8  // Type representing reflect.rtype for noescape trick
     9  type Type struct{}
    10  
    11  //go:linkname rtype_Align reflect.(*rtype).Align
    12  //go:noescape
    13  func rtype_Align(*Type) int
    14  
    15  func (t *Type) Align() int {
    16  	return rtype_Align(t)
    17  }
    18  
    19  //go:linkname rtype_FieldAlign reflect.(*rtype).FieldAlign
    20  //go:noescape
    21  func rtype_FieldAlign(*Type) int
    22  
    23  func (t *Type) FieldAlign() int {
    24  	return rtype_FieldAlign(t)
    25  }
    26  
    27  //go:linkname rtype_Method reflect.(*rtype).Method
    28  //go:noescape
    29  func rtype_Method(*Type, int) reflect.Method
    30  
    31  func (t *Type) Method(a0 int) reflect.Method {
    32  	return rtype_Method(t, a0)
    33  }
    34  
    35  //go:linkname rtype_MethodByName reflect.(*rtype).MethodByName
    36  //go:noescape
    37  func rtype_MethodByName(*Type, string) (reflect.Method, bool)
    38  
    39  func (t *Type) MethodByName(a0 string) (reflect.Method, bool) {
    40  	return rtype_MethodByName(t, a0)
    41  }
    42  
    43  //go:linkname rtype_NumMethod reflect.(*rtype).NumMethod
    44  //go:noescape
    45  func rtype_NumMethod(*Type) int
    46  
    47  func (t *Type) NumMethod() int {
    48  	return rtype_NumMethod(t)
    49  }
    50  
    51  //go:linkname rtype_Name reflect.(*rtype).Name
    52  //go:noescape
    53  func rtype_Name(*Type) string
    54  
    55  func (t *Type) Name() string {
    56  	return rtype_Name(t)
    57  }
    58  
    59  //go:linkname rtype_PkgPath reflect.(*rtype).PkgPath
    60  //go:noescape
    61  func rtype_PkgPath(*Type) string
    62  
    63  func (t *Type) PkgPath() string {
    64  	return rtype_PkgPath(t)
    65  }
    66  
    67  //go:linkname rtype_Size reflect.(*rtype).Size
    68  //go:noescape
    69  func rtype_Size(*Type) uintptr
    70  
    71  func (t *Type) Size() uintptr {
    72  	return rtype_Size(t)
    73  }
    74  
    75  //go:linkname rtype_String reflect.(*rtype).String
    76  //go:noescape
    77  func rtype_String(*Type) string
    78  
    79  func (t *Type) String() string {
    80  	return rtype_String(t)
    81  }
    82  
    83  //go:linkname rtype_Kind reflect.(*rtype).Kind
    84  //go:noescape
    85  func rtype_Kind(*Type) reflect.Kind
    86  
    87  func (t *Type) Kind() reflect.Kind {
    88  	return rtype_Kind(t)
    89  }
    90  
    91  //go:linkname rtype_Implements reflect.(*rtype).Implements
    92  //go:noescape
    93  func rtype_Implements(*Type, reflect.Type) bool
    94  
    95  func (t *Type) Implements(u reflect.Type) bool {
    96  	return rtype_Implements(t, u)
    97  }
    98  
    99  //go:linkname rtype_AssignableTo reflect.(*rtype).AssignableTo
   100  //go:noescape
   101  func rtype_AssignableTo(*Type, reflect.Type) bool
   102  
   103  func (t *Type) AssignableTo(u reflect.Type) bool {
   104  	return rtype_AssignableTo(t, u)
   105  }
   106  
   107  //go:linkname rtype_ConvertibleTo reflect.(*rtype).ConvertibleTo
   108  //go:noescape
   109  func rtype_ConvertibleTo(*Type, reflect.Type) bool
   110  
   111  func (t *Type) ConvertibleTo(u reflect.Type) bool {
   112  	return rtype_ConvertibleTo(t, u)
   113  }
   114  
   115  //go:linkname rtype_Comparable reflect.(*rtype).Comparable
   116  //go:noescape
   117  func rtype_Comparable(*Type) bool
   118  
   119  func (t *Type) Comparable() bool {
   120  	return rtype_Comparable(t)
   121  }
   122  
   123  //go:linkname rtype_Bits reflect.(*rtype).Bits
   124  //go:noescape
   125  func rtype_Bits(*Type) int
   126  
   127  func (t *Type) Bits() int {
   128  	return rtype_Bits(t)
   129  }
   130  
   131  //go:linkname rtype_ChanDir reflect.(*rtype).ChanDir
   132  //go:noescape
   133  func rtype_ChanDir(*Type) reflect.ChanDir
   134  
   135  func (t *Type) ChanDir() reflect.ChanDir {
   136  	return rtype_ChanDir(t)
   137  }
   138  
   139  //go:linkname rtype_IsVariadic reflect.(*rtype).IsVariadic
   140  //go:noescape
   141  func rtype_IsVariadic(*Type) bool
   142  
   143  func (t *Type) IsVariadic() bool {
   144  	return rtype_IsVariadic(t)
   145  }
   146  
   147  //go:linkname rtype_Elem reflect.(*rtype).Elem
   148  //go:noescape
   149  func rtype_Elem(*Type) reflect.Type
   150  
   151  func (t *Type) Elem() *Type {
   152  	return Type2RType(rtype_Elem(t))
   153  }
   154  
   155  //go:linkname rtype_Field reflect.(*rtype).Field
   156  //go:noescape
   157  func rtype_Field(*Type, int) reflect.StructField
   158  
   159  func (t *Type) Field(i int) reflect.StructField {
   160  	return rtype_Field(t, i)
   161  }
   162  
   163  //go:linkname rtype_FieldByIndex reflect.(*rtype).FieldByIndex
   164  //go:noescape
   165  func rtype_FieldByIndex(*Type, []int) reflect.StructField
   166  
   167  func (t *Type) FieldByIndex(index []int) reflect.StructField {
   168  	return rtype_FieldByIndex(t, index)
   169  }
   170  
   171  //go:linkname rtype_FieldByName reflect.(*rtype).FieldByName
   172  //go:noescape
   173  func rtype_FieldByName(*Type, string) (reflect.StructField, bool)
   174  
   175  func (t *Type) FieldByName(name string) (reflect.StructField, bool) {
   176  	return rtype_FieldByName(t, name)
   177  }
   178  
   179  //go:linkname rtype_FieldByNameFunc reflect.(*rtype).FieldByNameFunc
   180  //go:noescape
   181  func rtype_FieldByNameFunc(*Type, func(string) bool) (reflect.StructField, bool)
   182  
   183  func (t *Type) FieldByNameFunc(match func(string) bool) (reflect.StructField, bool) {
   184  	return rtype_FieldByNameFunc(t, match)
   185  }
   186  
   187  //go:linkname rtype_In reflect.(*rtype).In
   188  //go:noescape
   189  func rtype_In(*Type, int) reflect.Type
   190  
   191  func (t *Type) In(i int) reflect.Type {
   192  	return rtype_In(t, i)
   193  }
   194  
   195  //go:linkname rtype_Key reflect.(*rtype).Key
   196  //go:noescape
   197  func rtype_Key(*Type) reflect.Type
   198  
   199  func (t *Type) Key() *Type {
   200  	return Type2RType(rtype_Key(t))
   201  }
   202  
   203  //go:linkname rtype_Len reflect.(*rtype).Len
   204  //go:noescape
   205  func rtype_Len(*Type) int
   206  
   207  func (t *Type) Len() int {
   208  	return rtype_Len(t)
   209  }
   210  
   211  //go:linkname rtype_NumField reflect.(*rtype).NumField
   212  //go:noescape
   213  func rtype_NumField(*Type) int
   214  
   215  func (t *Type) NumField() int {
   216  	return rtype_NumField(t)
   217  }
   218  
   219  //go:linkname rtype_NumIn reflect.(*rtype).NumIn
   220  //go:noescape
   221  func rtype_NumIn(*Type) int
   222  
   223  func (t *Type) NumIn() int {
   224  	return rtype_NumIn(t)
   225  }
   226  
   227  //go:linkname rtype_NumOut reflect.(*rtype).NumOut
   228  //go:noescape
   229  func rtype_NumOut(*Type) int
   230  
   231  func (t *Type) NumOut() int {
   232  	return rtype_NumOut(t)
   233  }
   234  
   235  //go:linkname rtype_Out reflect.(*rtype).Out
   236  //go:noescape
   237  func rtype_Out(*Type, int) reflect.Type
   238  
   239  //go:linkname PtrTo reflect.(*rtype).ptrTo
   240  //go:noescape
   241  func PtrTo(*Type) *Type
   242  
   243  func (t *Type) Out(i int) reflect.Type {
   244  	return rtype_Out(t, i)
   245  }
   246  
   247  //go:linkname IfaceIndir reflect.ifaceIndir
   248  //go:noescape
   249  func IfaceIndir(*Type) bool
   250  
   251  //go:linkname RType2Type reflect.toType
   252  //go:noescape
   253  func RType2Type(t *Type) reflect.Type
   254  
   255  type emptyInterface struct {
   256  	_   *Type
   257  	ptr unsafe.Pointer
   258  }
   259  
   260  func Type2RType(t reflect.Type) *Type {
   261  	return (*Type)(((*emptyInterface)(unsafe.Pointer(&t))).ptr)
   262  }