aboutsummaryrefslogtreecommitdiff
path: root/mingling_macros
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-06-20 01:11:25 +0800
committer魏曹先生 <1992414357@qq.com>2026-06-20 01:11:25 +0800
commit9d491352d161ee629cc47459537344ba0ea4bb35 (patch)
tree40d847da5cfafce48c3ca99c78bcc077da4c4fb2 /mingling_macros
parent8749087c5035fbe4c0dce0893a39e0e2265fa130 (diff)
Add shared `MockProgramCollect` and conditional `Groupped` bounds
Extract duplicate `MockCollect` implementations into a reusable `MockProgramCollect` type. Conditionally require `Serialize` on the `Groupped` trait when the `general_renderer` feature is enabled.
Diffstat (limited to 'mingling_macros')
-rw-r--r--mingling_macros/src/dispatcher.rs1
-rw-r--r--mingling_macros/src/lib.rs7
2 files changed, 7 insertions, 1 deletions
diff --git a/mingling_macros/src/dispatcher.rs b/mingling_macros/src/dispatcher.rs
index 7e973eb..6bf10f1 100644
--- a/mingling_macros/src/dispatcher.rs
+++ b/mingling_macros/src/dispatcher.rs
@@ -223,6 +223,7 @@ pub fn dispatcher(input: TokenStream) -> TokenStream {
::mingling::macros::node!(#command_name_str)
}
fn begin(&self, args: Vec<String>) -> ::mingling::ChainProcess<#program_path> {
+ use ::mingling::Groupped;
#pack::new(args).to_chain()
}
fn clone_dispatcher(&self) -> Box<dyn ::mingling::Dispatcher<#program_path>> {
diff --git a/mingling_macros/src/lib.rs b/mingling_macros/src/lib.rs
index 408450a..9880cd6 100644
--- a/mingling_macros/src/lib.rs
+++ b/mingling_macros/src/lib.rs
@@ -480,7 +480,7 @@ pub fn route(input: TokenStream) -> TokenStream {
#[proc_macro]
pub fn empty_result(_input: TokenStream) -> TokenStream {
let expanded = quote! {
- crate::ResultEmpty::new(()).to_chain()
+ <crate::ResultEmpty as ::mingling::Groupped::<crate::ThisProgram>>::to_chain(crate::ResultEmpty::new(()))
};
TokenStream::from(expanded)
}
@@ -1413,6 +1413,8 @@ pub fn program_comp_gen(input: TokenStream) -> TokenStream {
#[doc(hidden)]
#[::mingling::macros::chain(#name)]
pub async fn __exec_completion(prev: CompletionContext) -> Next {
+ use ::mingling::Groupped;
+
let read_ctx = ::mingling::ShellContext::try_from(prev.inner);
match read_ctx {
Ok(ctx) => {
@@ -1429,6 +1431,8 @@ pub fn program_comp_gen(input: TokenStream) -> TokenStream {
#[doc(hidden)]
#[::mingling::macros::chain(#name)]
pub fn __exec_completion(prev: CompletionContext) -> Next {
+ use ::mingling::Groupped;
+
let read_ctx = ::mingling::ShellContext::try_from(prev.inner);
match read_ctx {
Ok(ctx) => {
@@ -1452,6 +1456,7 @@ pub fn program_comp_gen(input: TokenStream) -> TokenStream {
#[doc(hidden)]
mod __internal_completion_mod {
use super::#name;
+ use ::mingling::Groupped;
::mingling::macros::dispatcher!(#name, "__comp", CMDCompletion => CompletionContext);
::mingling::macros::pack!(
#name,