diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-08-17 03:27:46 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-08-17 03:27:46 +0800 |
| commit | c23c590330af83afb6e146bcd9b0a274b3689d22 (patch) | |
| tree | 34599cf2737ce4de22653c9ccae2d60a38a15842 /examples/example-dispatch-tree/src | |
| parent | 6980fbf2f9fb4c599d8dc6ff549a8b3288eb24e9 (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 'examples/example-dispatch-tree/src')
| -rw-r--r-- | examples/example-dispatch-tree/src/main.rs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/examples/example-dispatch-tree/src/main.rs b/examples/example-dispatch-tree/src/main.rs index a25af2a..bba9c2e 100644 --- a/examples/example-dispatch-tree/src/main.rs +++ b/examples/example-dispatch-tree/src/main.rs @@ -23,20 +23,20 @@ use std::io::Write; // --------- IMPORTANT --------- // You have a large number of subcommands -dispatcher!("cmd1", CMD1 => Entry1); -dispatcher!("cmd2.sub1", CMD2Sub1 => Entry2Sub1); -dispatcher!("cmd2.sub2", CMD2Sub2 => Entry2Sub2); -dispatcher!("cmd3.sub1.leaf1", CMD3Sub1Leaf1 => Entry3Sub1Leaf1); -dispatcher!("cmd3.sub1.leaf2", CMD3Sub1Leaf2 => Entry3Sub1Leaf2); -dispatcher!("cmd3.sub2", CMD3Sub2 => Entry3Sub2); -dispatcher!("cmd4.sub1.subsub1.deep", CMD4Deep => Entry4Deep); -dispatcher!("cmd4.sub1.subsub2", CMD4SubSub2 => Entry4SubSub2); -dispatcher!("cmd5", CMD5 => Entry5); -dispatcher!("cmd5.extra", CMD5Extra => Entry5Extra); -dispatcher!("nested.a.b.c", CMDA => EntryA); -dispatcher!("nested.a.b.d", CMDB => EntryB); -dispatcher!("nested.a.e", CMDC => EntryC); -dispatcher!("nested.f", CMDD => EntryD); +dispatcher!("cmd1", Entry1); +dispatcher!("cmd2.sub1", Entry2Sub1); +dispatcher!("cmd2.sub2", Entry2Sub2); +dispatcher!("cmd3.sub1.leaf1", Entry3Sub1Leaf1); +dispatcher!("cmd3.sub1.leaf2", Entry3Sub1Leaf2); +dispatcher!("cmd3.sub2", Entry3Sub2); +dispatcher!("cmd4.sub1.subsub1.deep", Entry4Deep); +dispatcher!("cmd4.sub1.subsub2", Entry4SubSub2); +dispatcher!("cmd5", Entry5); +dispatcher!("cmd5.extra", Entry5Extra); +dispatcher!("nested.a.b.c", EntryA); +dispatcher!("nested.a.b.d", EntryB); +dispatcher!("nested.a.e", EntryC); +dispatcher!("nested.f", EntryD); // --------- IMPORTANT --------- fn main() { |
