aboutsummaryrefslogtreecommitdiff
path: root/docs/pages/6-argument-parse-picker.md
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-08-17 03:27:46 +0800
committer魏曹先生 <1992414357@qq.com>2026-08-17 03:27:46 +0800
commitc23c590330af83afb6e146bcd9b0a274b3689d22 (patch)
tree34599cf2737ce4de22653c9ccae2d60a38a15842 /docs/pages/6-argument-parse-picker.md
parent6980fbf2f9fb4c599d8dc6ff549a8b3288eb24e9 (diff)
refactor!: remove Node type and simplify dispatcher macro syntax
The `dispatcher!` macro no longer requires a `CMD*` dispatcher type argument; the dispatcher struct is now generated internally as `__Dispatcher{Pascal}`. The `Node` type, `node!` macro, and `Dispatcher::node()` / `clone_dispatcher()` methods are removed.
Diffstat (limited to 'docs/pages/6-argument-parse-picker.md')
-rw-r--r--docs/pages/6-argument-parse-picker.md24
1 files changed, 12 insertions, 12 deletions
diff --git a/docs/pages/6-argument-parse-picker.md b/docs/pages/6-argument-parse-picker.md
index d7d38af..9da56d5 100644
--- a/docs/pages/6-argument-parse-picker.md
+++ b/docs/pages/6-argument-parse-picker.md
@@ -26,7 +26,7 @@ Now let's see how `Picker` is written:
```rust
// Features: ["parser"]
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
@@@pack!(ResultName = String);
#[chain]
@@ -42,7 +42,7 @@ For the code above:
```rust
// Features: ["parser"]
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
@@@pack!(ResultName = String);
@@@#[chain]
@@@fn handle_greet_entry(prev: EntryGreet) -> Next {
@@ -55,7 +55,7 @@ Its semantics are:
```rust
// Features: ["parser"]
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
@@@pack!(ResultName = String);
@@@#[chain]
@@@fn handle_greet_entry(prev: EntryGreet) {
@@ -76,7 +76,7 @@ If your program needs to parse flag arguments (e.g. `greet --name Alice`), do th
```rust
// Features: ["parser"]
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
@@@pack!(ResultName = String);
#[chain]
@@ -90,7 +90,7 @@ Its semantics:
```rust
// Features: ["parser"]
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
@@@pack!(ResultName = String);
@@@#[chain]
@@@fn handle_greet_entry(prev: EntryGreet) {
@@ -113,7 +113,7 @@ For a single pick, `.unpack()` returns the value directly; for multiple picks, i
```rust
// Features: ["parser"]
-@@@dispatcher!("test", CMDTest => EntryTest);
+@@@dispatcher!("test", EntryTest);
@@@pack!(ResultInfo = (String, u8, u32));
#[chain]
@@ -141,7 +141,7 @@ Here's a simple example:
// Features: ["parser", "extras"]
@@@use mingling::macros::buffer;
@@@use mingling::macros::route;
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
@@@pack!(ResultName = String);
@@@pack!(ErrorNoName = ());
@@ -200,7 +200,7 @@ After picking user input with `pick`, you can use `after` to process it immediat
```rust
// Features: ["parser"]
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
@@@pack!(ResultName = String);
#[chain]
@@ -226,7 +226,7 @@ Similarly, you can use `after_or_route` to handle input format errors:
// Features: ["parser", "extras"]
@@@use mingling::macros::buffer;
@@@use mingling::macros::route;
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
@@@pack!(ResultName = String);
@@@pack!(ErrorNameTooLong = usize);
@@ -276,7 +276,7 @@ Implicit mode is generally sufficient, but for important confirmations, explicit
```rust
// Features: ["parser"]
@@@use mingling::parser::Yes;
-@@@dispatcher!("test", CMDTest => EntryTest);
+@@@dispatcher!("test", EntryTest);
@@@pack!(ResultDone = ());
#[chain]
@@ -329,7 +329,7 @@ impl Pickable for Address {
Some(Address { ip, port })
}
}
-@@@dispatcher!("connect", CMDConnect => EntryConnect);
+@@@dispatcher!("connect", EntryConnect);
@@@pack!(ResultConnected = Address);
#[chain]
@@ -369,7 +369,7 @@ pub enum Fruits {
}
impl PickableEnum for Fruits {}
-@@@dispatcher!("eat", CMDEat => EntryEat);
+@@@dispatcher!("eat", EntryEat);
@@@pack!(ResultFruit = Fruits);
#[chain]