From 8ead3c106b932fad81cc6e9993774a226f739179 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Fri, 8 May 2026 15:49:13 +0800 Subject: Dispatch arguments using prefix tree with dispatch_tree feature --- mingling_core/src/program.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'mingling_core/src/program.rs') 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, + ) -> Result, ChainProcessError> { + let string_vec: Vec = args.into().into(); + match C::dispatch_args_trie(&string_vec) { + Ok(ok) => Ok(ok), + Err(e) => Err(e.into()), + } + } } // Async program -- cgit