From c23c590330af83afb6e146bcd9b0a274b3689d22 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Mon, 17 Aug 2026 03:27:46 +0800 Subject: 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. --- examples/example-dispatch-tree/src/main.rs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'examples/example-dispatch-tree/src/main.rs') 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() { -- cgit