渲染zh-Hans

异流

Translation status: 简体中文 reader-locale proof. Term names and code fences follow the zh-Hans pack; supporting prose may still be English.

Callable posture for asynchronous stream functions.

Aliases: async_generator

Syntax: 函数 name(…) 异流 → T

Category#

async

Examples#

radix/corpus/fient/fient.fab (canonical · keyword)#

Callable posture for asynchronous stream functions.

# =============================================================================
# 异流 — Asynchronous stream callable posture
# =============================================================================
#
# What this teaches:
#   • Async stream posture: `异流 → T` yields promised pulls of `T`.
#   • Yield with `让出`; consume the stream with `遍历 取自` inside an async body.
#
# Common mistakes:
#   • Expecting every backend to lower `异流` — some fail closed until a
#     channel/async-cursor carrier lands.
#
# See also: 流, 异步, 让出
# =============================================================================

# GRAMMAR:
#   callablePosture :← '异流'
#
# BACKEND:
#   Product path is Rust async-cursor; other backends may fail closed.

函数 stream() 异流 → 整数 {
    让出 1
    让出 2
}

异步入口 {
    遍历 取自 stream() 常量 n {
        显示 n
    }
}

Expected output:

1
2