รับ
Translation status: ภาษาไทย reader-locale proof. Term names and code fences follow the th-TH pack; supporting prose may still be English.
typed inbound ช่องทาง stream view
Syntax:
Category#
endpoint
Related#
- ถึง
- ช่องทาง
- scrinium
- เคอร์เซอร์
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: