github.com/zerosnake0/jzon@v0.0.9-0.20230801092939-1b135cb83f7f/iface.go (about) 1 package jzon 2 3 import ( 4 "unsafe" 5 ) 6 7 type iface struct { 8 itab *itab 9 data unsafe.Pointer 10 } 11 12 type itab struct { 13 ignore uintptr 14 rtype rtype 15 } 16 17 func packIFace(ptr unsafe.Pointer) interface{} { 18 iface := (*iface)(ptr) 19 if iface.itab == nil { 20 return nil 21 } 22 return packEFace(iface.itab.rtype, iface.data) 23 }