aboutsummaryrefslogtreecommitdiff
path: root/examples/example-dispatch-tree
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-08-17 02:29:30 +0800
committer魏曹先生 <1992414357@qq.com>2026-08-17 02:39:56 +0800
commit6980fbf2f9fb4c599d8dc6ff549a8b3288eb24e9 (patch)
treebc7049698955d7a40706ea691fd5bab526a6b5e5 /examples/example-dispatch-tree
parent4c191b2b46a67a0dda6e9a867b40f45156af4f9c (diff)
refactor!: remove dynamic dispatcher registration API
Dispatchers are now always registered at compile time, removing the `with_dispatcher` / `with_dispatchers` methods and the `PathfinderConfig` API. The `dispatch_tree` feature now only controls the matching strategy (trie vs linear list).
Diffstat (limited to 'examples/example-dispatch-tree')
-rw-r--r--examples/example-dispatch-tree/src/main.rs14
1 files changed, 3 insertions, 11 deletions
diff --git a/examples/example-dispatch-tree/src/main.rs b/examples/example-dispatch-tree/src/main.rs
index 9f76f15..a25af2a 100644
--- a/examples/example-dispatch-tree/src/main.rs
+++ b/examples/example-dispatch-tree/src/main.rs
@@ -3,11 +3,9 @@
//! > This example will introduce how to use `dispatch_tree`
//! > to optimize your command line lookup efficiency
//!
-//! When the number of commands in your project increases, you can use `dispatch_tree` to complete command registration at compile time.
-//! It will generate a trie for quickly finding related commands by prefix.
-//!
-//! Therefore, after enabling this feature,
-//! `Program` will no longer store a Dispatcher list internally, and the `with_dispatcher` function will not be compiled.
+//! When the number of commands in your project increases, you can enable
+//! `dispatch_tree` to switch command matching from a linear scan to a
+//! character-level trie.
//!
//! Run:
//! ```bash
@@ -43,12 +41,6 @@ dispatcher!("nested.f", CMDD => EntryD);
fn main() {
let program = ThisProgram::new();
-
- // --------- IMPORTANT ---------
- // // You no longer need to use `with_dispatcher` anymore;
- // // it'll be collected automatically once the `dispatch_tree` feature is enabled
- // program.with_dispatcher(...);
-
program.exec_and_exit();
}