From 1df1fc664c4a4b12807a49ef2f1a0effda6ce064 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Tue, 23 Jun 2026 00:40:05 +0800 Subject: Add compile-time duplicate variant detection Add duplicate variant checks for chain, renderer, help, and completion registrations to produce a clear compile error instead of silently generating unreachable code --- docs/_zh_CN/pages/other/features.md | 20 ++++++++++---------- docs/pages/other/features.md | 18 +++++++++--------- 2 files changed, 19 insertions(+), 19 deletions(-) (limited to 'docs') diff --git a/docs/_zh_CN/pages/other/features.md b/docs/_zh_CN/pages/other/features.md index cdb2220..558720c 100644 --- a/docs/_zh_CN/pages/other/features.md +++ b/docs/_zh_CN/pages/other/features.md @@ -25,7 +25,7 @@ pack!(StateFoo = ()); #[chain] async fn handle_state_foo(foo: StateFoo) -> Next { StateFoo::new(()) -} +} ``` 详见 [示例](https://mingling-rs.github.io/mingling/docs/example-viewer.html?name=example-async-support) @@ -92,14 +92,14 @@ fn main() { 例如,允许 `dispatcher!("greet")` 的缩写形式,自动生成 `CMDGreet` / `EntryGreet`。 -| 宏 | 说明 | -|---|---| -| `empty_result!()` | 链中提前返回空结果的简写 | -| `entry!(Type, ["a", "b"])` | 构造入口类型的测试数据 | -| `group!(Type)` | 将外部类型注册为组成员,无需修改其定义 | -| `pack_err!(ErrorType)` / `pack_err!(ErrorType = Inner)` | 创建带自动 `name` 字段的错误类型 | -| `#[program_setup]` | 声明程序初始化函数 | -| `dispatcher!("cmd.path")` **缩写形式** | 省略 `CMDStruct => EntryStruct`,名字自动推导 | +| 宏 | 说明 | +| ------------------------------------------------------- | --------------------------------------------- | +| `empty_result!()` | 链中提前返回空结果的简写 | +| `entry!(Type, ["a", "b"])` | 构造入口类型的测试数据 | +| `group!(Type)` | 将外部类型注册为组成员,无需修改其定义 | +| `pack_err!(ErrorType)` / `pack_err!(ErrorType = Inner)` | 创建带自动 `name` 字段的错误类型 | +| `#[program_setup]` | 声明程序初始化函数 | +| `dispatcher!("cmd.path")` **缩写形式** | 省略 `CMDStruct => EntryStruct`,名字自动推导 |
Details @@ -115,7 +115,7 @@ pack!(StatePrev2 = ()); pack!(StateNext = ()); #[chain] -fn handle_state_prev2(_p: StatePrev1) { +fn handle_state_prev2(_p: StatePrev2) { // 无 Next 的 #[chain] 可以直接不返回值 } diff --git a/docs/pages/other/features.md b/docs/pages/other/features.md index 6e2a364..5ee0497 100644 --- a/docs/pages/other/features.md +++ b/docs/pages/other/features.md @@ -92,14 +92,14 @@ Enables an additional set of macros, providing more convenient syntactic sugar a For example, allows the shorthand form `dispatcher!("greet")`, which auto-generates `CMDGreet` / `EntryGreet`. -| Macro | Description | -|---|---| -| `empty_result!()` | Shorthand for returning an empty result early in a chain | -| `entry!(Type, ["a", "b"])` | Construct test data for an entry type | -| `group!(Type)` | Register external types as group members without modifying them | -| `pack_err!(ErrorType)` / `pack_err!(ErrorType = Inner)` | Create error types with an automatic `name` field | -| `#[program_setup]` | Declare a program initialization function | -| `dispatcher!("cmd.path")` **shorthand** | Omit `CMDStruct => EntryStruct`, names are auto-derived | +| Macro | Description | +| ------------------------------------------------------- | --------------------------------------------------------------- | +| `empty_result!()` | Shorthand for returning an empty result early in a chain | +| `entry!(Type, ["a", "b"])` | Construct test data for an entry type | +| `group!(Type)` | Register external types as group members without modifying them | +| `pack_err!(ErrorType)` / `pack_err!(ErrorType = Inner)` | Create error types with an automatic `name` field | +| `#[program_setup]` | Declare a program initialization function | +| `dispatcher!("cmd.path")` **shorthand** | Omit `CMDStruct => EntryStruct`, names are auto-derived |
Details @@ -115,7 +115,7 @@ pack!(StatePrev2 = ()); pack!(StateNext = ()); #[chain] -fn handle_state_prev2(_p: StatePrev1) { +fn handle_state_prev2(_p: StatePrev2) { // A #[chain] with no return type can simply omit the return value } -- cgit