發送
Translation status: 繁體中文 reader-locale proof. Term names and code fences follow the zh-Hant pack; supporting prose may still be English.
live outbound and inbound 通道 directional views
Syntax:
Category#
endpoint
Related#
Examples#
radix/corpus/ad/sermo-live-directional.fab (canonical · method)#
live outbound and inbound 通道 directional views
# =============================================================================
# 發送 — live outbound and inbound 通道 directional views.
# =============================================================================
#
# What this teaches:
# • Directional 通道 views — `發送<T>` for outbound frames, `接收<T>` for
# inbound frames on a 通道 connection
# • Cursor iteration — `遍歷 取自 t.cursor()` consumes inbound frames
# • Accipe reception — `accipe()` pulls a single 幀 from the inbound
# 佇列
#
# Common mistakes:
# • confusing `發送` (outbound) and `接收` (inbound) 通道 directional views, or mixing accipe/cursor/exhauri without intentional ordered consumption
#
# See also: 端點, 通道, 接收, 幀, 迭代器, accipe
# =============================================================================
# Live `發送<T>` / `接收<T>` directional views
#
# runtime:echo returns one inbound 文字 frame per conversation.
# accipe, 迭代器, and exhauri may share one 接收 佇列; mix them only when
# ordered consumption is intentional.
main {
const 通道 s ← call 'runtime:echo' ("salve")
const 發送<string> m ← s.meus<string>()
m.da("ping")
const status outbound ← m.fini()
const 接收<string> t ← s.tuus<string>()
for from t.cursor() const frame {
assert frame.data ≡ "salve"
}
const status inbound ← t.fini()
const 通道 s2 ← call 'runtime:echo' ("salve")
const 接收<string> t2 ← s2.tuus<string>()
const 幀<string> ∪ none got ← t2.accipe()
const status accipe_done ← t2.fini()
print outbound
print inbound
print got
print accipe_done
}