Skip to content

Commit 3cc9f01

Browse files
committed
add img
1 parent cab2063 commit 3cc9f01

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

interface.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,43 @@ func CreateOrder(order OrderStruct) {
113113

114114
## eface
115115

116+
从定义来看,eface 其实是 iface 的一个子集:
117+
118+
```
119+
┌─────────┐ ┌─────────┐
120+
│ iface │ ┌─────▶│ itab │
121+
├─────────┴───────────────────┐ │ ├─────────┴───────────────────┐
122+
│ tab *itab │──────┘ │ inter *interfacetype │
123+
┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫ ├─────────────────────────────┤
124+
┃ data unsafe.Pointer ┃ ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
125+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ ┃ _type *_type ┃
126+
┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
127+
├─────────────────────────────┤
128+
│ hash uint32 │
129+
├─────────────────────────────┤
130+
│ fun [1]uintptr │
131+
└─────────────────────────────┘
132+
┌─────────┐
133+
│ eface │
134+
├─────────┴───────────────────┐
135+
│ _type *_type │
136+
├─────────────────────────────┤
137+
│ data unsafe.Pointer │
138+
└─────────────────────────────┘
139+
```
140+
116141
### eface 适用场景
117142

118143
### eface 实现原理
144+
145+
## 类型转换
146+
147+
### 普通类型转换为 eface
148+
149+
### 普通类型转换为 iface
150+
151+
### eface 转换为普通类型
152+
153+
### iface 转换为普通类型
154+
155+
### 类型转换图

0 commit comments

Comments
 (0)