aboutsummaryrefslogtreecommitdiff
path: root/mingling_macros/src/dispatch_tree_gen.rs
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-05-07 23:33:02 +0800
committer魏曹先生 <1992414357@qq.com>2026-05-07 23:33:02 +0800
commit5dbf91c920c64f47236771eec374eeea20838d88 (patch)
tree5f99e3511e8164167ed3b49029b4a3116de5c551 /mingling_macros/src/dispatch_tree_gen.rs
parent3fd12ea50e0f7e041182658d35a9dc72abf86464 (diff)
Log node strings in get_nodes for debug builds
Diffstat (limited to 'mingling_macros/src/dispatch_tree_gen.rs')
-rw-r--r--mingling_macros/src/dispatch_tree_gen.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/mingling_macros/src/dispatch_tree_gen.rs b/mingling_macros/src/dispatch_tree_gen.rs
index 840fe15..3967aac 100644
--- a/mingling_macros/src/dispatch_tree_gen.rs
+++ b/mingling_macros/src/dispatch_tree_gen.rs
@@ -104,14 +104,14 @@ fn build_dispatch_body(nodes: &[(String, String)], depth: usize) -> TokenStream
let name_space = format!("{} ", name);
let name_lit = syn::LitStr::new(&name_space, proc_macro2::Span::call_site());
let disp_ident = syn::Ident::new(disp_type, proc_macro2::Span::call_site());
+ let prefix_word_count = name.split_whitespace().count();
quote! {
- if let Some(stripped) = raw_str.strip_prefix(#name_lit) {
+ if raw_str.starts_with(#name_lit) {
+ let prefix_len = #prefix_word_count;
+ let trimmed_args: Vec<String> = raw.iter().skip(prefix_len).cloned().collect();
let __cp = <#disp_ident as ::mingling::Dispatcher<Self::Enum>>::begin(
&#disp_ident::default(),
- stripped
- .split_whitespace()
- .map(String::from)
- .collect::<Vec<String>>(),
+ trimmed_args,
);
return match __cp {
::mingling::ChainProcess::Ok(any_output) => Ok(any_output.0),