aboutsummaryrefslogtreecommitdiff
path: root/mingling_core/src/program.rs
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-05-08 15:49:13 +0800
committer魏曹先生 <1992414357@qq.com>2026-05-08 15:49:13 +0800
commit8ead3c106b932fad81cc6e9993774a226f739179 (patch)
treed4d0a1c3e0cb8e66fb0316209c8006ba379bd8aa /mingling_core/src/program.rs
parentb47bdc15fdb78ac5e78b2e04aca0190c84aa78f4 (diff)
Dispatch arguments using prefix tree with dispatch_tree feature
Diffstat (limited to 'mingling_core/src/program.rs')
-rw-r--r--mingling_core/src/program.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/mingling_core/src/program.rs b/mingling_core/src/program.rs
index c7544f5..f305e88 100644
--- a/mingling_core/src/program.rs
+++ b/mingling_core/src/program.rs
@@ -8,7 +8,7 @@ use crate::error::GeneralRendererSerializeError;
use std::env;
use crate::{
- AnyOutput, ChainProcess, GlobalResources, RenderResult,
+ AnyOutput, ChainProcess, GlobalResources, Groupped, RenderResult,
asset::dispatcher::Dispatcher,
error::{ChainProcessError, ProgramExecuteError},
};
@@ -148,6 +148,19 @@ where
Err(e) => Err(e.into()),
}
}
+
+ /// Use a prefix tree to quickly match arguments and dispatch to an Entry
+ #[cfg(feature = "dispatch_tree")]
+ pub fn dispatch_args_trie(
+ &'static self,
+ args: impl Into<StringVec>,
+ ) -> Result<AnyOutput<C>, ChainProcessError> {
+ let string_vec: Vec<String> = args.into().into();
+ match C::dispatch_args_trie(&string_vec) {
+ Ok(ok) => Ok(ok),
+ Err(e) => Err(e.into()),
+ }
+ }
}
// Async program