From 68a652ed2f51d366bb8033497e6dfe545895410e Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Thu, 23 Jul 2026 08:08:33 +0800 Subject: feat: scaffold crate structure and implement core macros Add the project skeleton, LICENSE files, README, Makefile, doc examples, and the initial implementation of `#[func]`, `invoke!`, and `select!` procedural macros. --- doc/select.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 doc/select.md (limited to 'doc/select.md') diff --git a/doc/select.md b/doc/select.md new file mode 100644 index 0000000..d2330bd --- /dev/null +++ b/doc/select.md @@ -0,0 +1,22 @@ +Procedural macro that chooses between two expressions based on whether the +async feature is enabled, producing a value. + +## Explicit mode + +Each arm is labelled with a feature name. When the named feature is enabled +that arm is selected; otherwise the other arm is used. Since only one feature +is ever active at a time, the arm labelled `"sync"` effectively acts as an else +branch. + +The `!` token inverts the sense — it selects the arm when the corresponding +feature is **not** enabled. + +## Implicit mode + +Feature names are omitted; the macro inspects the token stream to decide which +expression is async. Whichever arm contains a `.await` call is treated as the +async branch. + +When neither arm contains `.await`, the first expression is assigned to the +async branch and the second to sync. The two branches trade places during +expansion so the correct one is active in each mode. -- cgit