diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-04-01 08:11:01 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-04-01 08:11:01 +0800 |
| commit | f3d6f76dfd07c35dabc11aa86d86c3671cd283c5 (patch) | |
| tree | 75b53f9bd8eb7779331c9599d557b82a589165c8 /mingling_macros/src | |
| parent | a97f077f406b1748ba3259ca4b92f5719832ae0a (diff) | |
Rename chain_struct to pack in dispatcher macros
Diffstat (limited to 'mingling_macros/src')
| -rw-r--r-- | mingling_macros/src/dispatcher_chain.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/mingling_macros/src/dispatcher_chain.rs b/mingling_macros/src/dispatcher_chain.rs index d9d95a5..57c11a3 100644 --- a/mingling_macros/src/dispatcher_chain.rs +++ b/mingling_macros/src/dispatcher_chain.rs @@ -12,7 +12,7 @@ use syn::{Ident, Result as SynResult, Token}; struct DispatcherChainInput { command_name: syn::LitStr, command_struct: Ident, - chain_struct: Ident, + pack: Ident, } impl Parse for DispatcherChainInput { @@ -21,12 +21,12 @@ impl Parse for DispatcherChainInput { input.parse::<Token![,]>()?; let command_struct = input.parse()?; input.parse::<Token![=>]>()?; - let chain_struct = input.parse()?; + let pack = input.parse()?; Ok(DispatcherChainInput { command_name, command_struct, - chain_struct, + pack, }) } } @@ -35,7 +35,7 @@ pub fn dispatcher_chain(input: TokenStream) -> TokenStream { let DispatcherChainInput { command_name, command_struct, - chain_struct, + pack, } = syn::parse_macro_input!(input as DispatcherChainInput); let command_name_str = command_name.value(); @@ -44,14 +44,14 @@ pub fn dispatcher_chain(input: TokenStream) -> TokenStream { #[derive(Debug, Default)] pub struct #command_struct; - ::mingling::macros::chain_struct!(#chain_struct = Vec<String>); + ::mingling::macros::pack!(#pack = Vec<String>); impl ::mingling::Dispatcher for #command_struct { fn node(&self) -> ::mingling::Node { ::mingling::macros::node!(#command_name_str) } fn begin(&self, args: Vec<String>) -> ::mingling::ChainProcess { - #chain_struct::new(args).to_chain() + #pack::new(args).to_chain() } fn clone_dispatcher(&self) -> Box<dyn ::mingling::Dispatcher> { Box::new(#command_struct) @@ -66,7 +66,7 @@ pub fn dispatcher_render(input: TokenStream) -> TokenStream { let DispatcherChainInput { command_name, command_struct, - chain_struct, + pack, } = syn::parse_macro_input!(input as DispatcherChainInput); let command_name_str = command_name.value(); @@ -75,14 +75,14 @@ pub fn dispatcher_render(input: TokenStream) -> TokenStream { #[derive(Debug, Default)] pub struct #command_struct; - ::mingling::macros::chain_struct!(#chain_struct = Vec<String>); + ::mingling::macros::pack!(#pack = Vec<String>); impl ::mingling::Dispatcher for #command_struct { fn node(&self) -> ::mingling::Node { ::mingling::macros::node!(#command_name_str) } fn begin(&self, args: Vec<String>) -> ::mingling::ChainProcess { - #chain_struct::new(args).to_render() + #pack::new(args).to_render() } fn clone_dispatcher(&self) -> Box<dyn ::mingling::Dispatcher> { Box::new(#command_struct) |
