diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-05-07 20:53:04 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-05-07 21:15:54 +0800 |
| commit | 6703ccb0fc3aca7ba4bdb9083f199fe0c1b66bd9 (patch) | |
| tree | 9cc0ea01bd42886cee93747068388076dd1d06f6 /mingling_core/src/asset | |
| parent | dd5fbe024003f9d76ba0e063ade6b60dee2ffaa8 (diff) | |
Add dispatch tree feature for fast argument matching
Diffstat (limited to 'mingling_core/src/asset')
| -rw-r--r-- | mingling_core/src/asset/comp.rs | 2 | ||||
| -rw-r--r-- | mingling_core/src/asset/dispatcher.rs | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/mingling_core/src/asset/comp.rs b/mingling_core/src/asset/comp.rs index a6299e1..cf1f48c 100644 --- a/mingling_core/src/asset/comp.rs +++ b/mingling_core/src/asset/comp.rs @@ -51,7 +51,7 @@ impl CompletionHelper { let program = this::<P>(); let args = ctx.all_words.iter().skip(1).cloned().collect::<Vec<_>>(); - let suggest = if let Ok((dispatcher, args)) = match_user_input(program, args) { + let suggest = if let Ok((dispatcher, args)) = match_user_input(program, &args) { trace!( "dispatcher matched, dispatcher=\"{}\", args={:?}", dispatcher.node().to_string(), diff --git a/mingling_core/src/asset/dispatcher.rs b/mingling_core/src/asset/dispatcher.rs index 761c399..cf8fcca 100644 --- a/mingling_core/src/asset/dispatcher.rs +++ b/mingling_core/src/asset/dispatcher.rs @@ -29,6 +29,7 @@ where impl<C: crate::program::ProgramCollect> Program<C> { /// Adds a dispatcher to the program. + #[cfg(not(feature = "dispatch_tree"))] pub fn with_dispatcher<Disp>(&mut self, dispatcher: Disp) where Disp: Dispatcher<C> + Send + Sync + 'static, @@ -37,6 +38,7 @@ impl<C: crate::program::ProgramCollect> Program<C> { } /// Add some dispatchers to the program. + #[cfg(not(feature = "dispatch_tree"))] pub fn with_dispatchers<D>(&mut self, dispatchers: D) where D: Into<Dispatchers<C>>, |
