8 type UnsafeStructType struct {
13 func newUnsafeStructType(cfg *frozenConfig, type1 reflect.Type) *UnsafeStructType {
14 return &UnsafeStructType{
15 unsafeType: *newUnsafeType(cfg, type1),
16 likePtr: likePtrType(type1),
20 func (type2 *UnsafeStructType) LikePtr() bool {
24 func (type2 *UnsafeStructType) Indirect(obj interface{}) interface{} {
25 objEFace := unpackEFace(obj)
26 assertType("Type.Indirect argument 1", type2.ptrRType, objEFace.rtype)
27 return type2.UnsafeIndirect(objEFace.data)
30 func (type2 *UnsafeStructType) UnsafeIndirect(ptr unsafe.Pointer) interface{} {
32 return packEFace(type2.rtype, *(*unsafe.Pointer)(ptr))
34 return packEFace(type2.rtype, ptr)
37 func (type2 *UnsafeStructType) FieldByName(name string) StructField {
38 structField, found := type2.Type.FieldByName(name)
42 return newUnsafeStructField(type2, structField)
45 func (type2 *UnsafeStructType) Field(i int) StructField {
46 return newUnsafeStructField(type2, type2.Type.Field(i))
49 func (type2 *UnsafeStructType) FieldByIndex(index []int) StructField {
50 return newUnsafeStructField(type2, type2.Type.FieldByIndex(index))
53 func (type2 *UnsafeStructType) FieldByNameFunc(match func(string) bool) StructField {
54 structField, found := type2.Type.FieldByNameFunc(match)
56 panic("field match condition not found in " + type2.Type.String())
58 return newUnsafeStructField(type2, structField)