接收
Translation status: 简体中文 reader-locale proof. Term names and code fences follow the zh-Hans pack; supporting prose may still be English.
typed inbound 通道 stream view
Syntax:
Category#
endpoint
Related#
Examples#
radix/corpus/ad/sermo-tuus.fab (canonical · method)#
typed inbound 通道 stream view
# =============================================================================
# 接收 — typed inbound 通道 stream view.
# =============================================================================
#
# What this teaches:
# • Typed inbound stream — `s.tuus<T>()` creates a typed view over the
# incoming frames of a 通道 connection
# • Cursor consumption — 迭代器() yields frames that can be iterated with
# `遍历 取自`
#
# Common mistakes:
# • confusing 调用 route syntax — accessing `接收<T>` stream after `fini()` has been called leaves no usable data
#
# See also: 调用, 通道, 帧, 迭代器
# =============================================================================
# sermo.tuus<T>() — typed inbound frame stream
main {
const 通道 s ← call 'runtime:echo' ("salve")
for from s.tuus<string>().cursor() const frame {
assert frame.data ≡ "salve"
}
}Expected output: