非同步入口
Translation status: 繁體中文 reader-locale proof. Term names and code fences follow the zh-Hant pack; supporting prose may still be English.
Declares the asynchronous program entry point.
Syntax: 非同步入口 <block>
Category#
entry
Related#
Examples#
radix/corpus/incipiet/incipiet.fab (canonical · keyword)#
Declares the asynchronous program entry point.
# =============================================================================
# 非同步入口 — Declares the asynchronous program entry point
# =============================================================================
#
# What this teaches:
# • Declares the asynchronous program entry point.
# • Related keywords: 入口, 等定, 等棄
#
# Common mistakes:
# • Calling a `異步` function without consuming its 承諾; use
# `等定`, `等變`, `等返`, or `等棄` inside an `非同步入口`.
#
# See also: 入口, 等定, 等棄
# =============================================================================
# 非同步入口 — async program entry point
#
# 非同步入口 { <body> }
#
# GRAMMAR:
# asyncEntry :← '非同步入口' block
#
# EXPECTED OUTPUT:
# none — Rust async runtime whitelist (compile-only in harness)
#
# BACKEND:
# Pairs with `異步` and awaited bindings; contrast with 入口
# (synchronous entry).
# Helper async finite function
fn accipe() async → string {
# Simulates async finite operation
return "datum paratum"
}
fn metire(string datum) async → int {
return datum.length()
}
# Futura entry point
async_main {
print "incipiet initium"
# Await 異步 functions with 等定
await_const string datum ← accipe()
print "acceptum: §"(datum)
await_const int longitudo ← metire(datum)
print "longitudo: §"(longitudo)
print "opus perfectum"
}Expected output:
incipiet initium
acceptum: datum paratum
longitudo: 13
opus perfectum