Renderingen-US

recv

Translation status: English reader-locale proof. Term names and code fences follow the en pack; supporting prose may still be English.

typed inbound channel stream view

Syntax:

Category#

endpoint

Examples#

radix/corpus/ad/sermo-tuus.fab (canonical · method)#

typed inbound channel stream view

# =============================================================================
# recv — typed inbound channel stream view.
# =============================================================================
#
# What this teaches:
#   • Typed inbound stream — `s.tuus<T>()` creates a typed view over the
#     incoming frames of a channel connection
#   • Cursor consumption — cursor() yields frames that can be iterated with
#     `for from`
#
# Common mistakes:
#   • confusing call route syntax — accessing `recv<T>` stream after `fini()` has been called leaves no usable data
#
# See also: call, channel, frame, cursor
# =============================================================================

# sermo.tuus<T>() — typed inbound frame stream

main {
    const channel s ← call 'runtime:echo' ("salve")
    for from s.tuus<string>().cursor() const frame {
        assert frame.data ≡ "salve"
    }
}

Expected output: