aboutsummaryrefslogtreecommitdiff
path: root/mingling_core/src/program/collection.rs
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 /mingling_core/src/program/collection.rs
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 'mingling_core/src/program/collection.rs')
-rw-r--r--mingling_core/src/program/collection.rs20
1 files changed, 6 insertions, 14 deletions
diff --git a/mingling_core/src/program/collection.rs b/mingling_core/src/program/collection.rs
index 438b800..c571887 100644
--- a/mingling_core/src/program/collection.rs
+++ b/mingling_core/src/program/collection.rs
@@ -2,7 +2,6 @@
#[cfg(feature = "async")]
use std::pin::Pin;
-#[cfg(feature = "dispatch_tree")]
use crate::Dispatcher;
use crate::{AnyOutput, ChainProcess, Grouped, RenderResult};
@@ -34,26 +33,19 @@ pub trait ProgramCollect {
/// you can use the `empty_result!()` macro to create this
type ResultEmpty: Grouped<Self::Enum>;
- /// Use a prefix tree to quickly match arguments and dispatch to an Entry
- #[cfg(feature = "dispatch_tree")]
- fn dispatch_args(
- raw: &[String],
- ) -> Result<AnyOutput<Self::Enum>, crate::error::ProgramInternalExecuteError>;
-
- #[cfg(not(feature = "dispatch_tree"))]
- /// Use a prefix tree to quickly match arguments and dispatch to an Entry
+ /// Dispatch the raw user arguments to an Entry.
+ ///
+ /// The concrete matching strategy (trie or linear list) is generated by
+ /// `gen_program!` and selected by the `dispatch_tree` feature.
///
/// # Errors
///
/// Returns an error if the program fails to execute the given arguments.
fn dispatch_args(
- _raw: &[String],
- ) -> Result<AnyOutput<Self::Enum>, crate::error::ProgramInternalExecuteError> {
- unreachable!()
- }
+ raw: &[String],
+ ) -> Result<AnyOutput<Self::Enum>, crate::error::ProgramInternalExecuteError>;
/// Get all registered dispatcher names from the program
- #[cfg(feature = "dispatch_tree")]
fn get_nodes() -> Vec<(String, &'static (dyn Dispatcher<Self::Enum> + Send + Sync))>;
/// Build an [`AnyOutput`](./struct.AnyOutput.html) to indicate that a renderer was not found