aboutsummaryrefslogtreecommitdiff
path: root/mingling_macros/src/dispatcher_chain.rs
diff options
context:
space:
mode:
Diffstat (limited to 'mingling_macros/src/dispatcher_chain.rs')
-rw-r--r--mingling_macros/src/dispatcher_chain.rs78
1 files changed, 0 insertions, 78 deletions
diff --git a/mingling_macros/src/dispatcher_chain.rs b/mingling_macros/src/dispatcher_chain.rs
index 4038600..6223a81 100644
--- a/mingling_macros/src/dispatcher_chain.rs
+++ b/mingling_macros/src/dispatcher_chain.rs
@@ -145,84 +145,6 @@ pub fn dispatcher_chain(input: TokenStream) -> TokenStream {
expanded.into()
}
-pub fn dispatcher_render(input: TokenStream) -> TokenStream {
- // Parse the input
- let dispatcher_input = syn::parse_macro_input!(input as DispatcherChainInput);
-
- // Determine if we're using default or explicit group
- let (group_name, command_name, command_struct, pack, use_default) = match dispatcher_input {
- DispatcherChainInput::Explicit {
- group_name,
- command_name,
- command_struct,
- pack,
- } => (group_name, command_name, command_struct, pack, false),
- DispatcherChainInput::Default {
- command_name,
- command_struct,
- pack,
- } => (
- Ident::new("ThisProgram", proc_macro2::Span::call_site()),
- command_name,
- command_struct,
- pack,
- true,
- ),
- };
-
- let command_name_str = command_name.value();
-
- let comp_entry = get_comp_entry(&pack);
-
- let expanded = if use_default {
- // For default case, use ThisProgram
- quote! {
- #[derive(Debug, Default)]
- pub struct #command_struct;
-
- ::mingling::macros::pack!(ThisProgram, #pack = Vec<String>);
-
- #comp_entry
-
- 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 {
- #pack::new(args).to_render()
- }
- fn clone_dispatcher(&self) -> Box<dyn ::mingling::Dispatcher> {
- Box::new(#command_struct)
- }
- }
- }
- } else {
- // For explicit case, use the provided group_name
- quote! {
- #[derive(Debug, Default)]
- pub struct #command_struct;
-
- ::mingling::macros::pack!(#group_name, #pack = Vec<String>);
-
- #comp_entry
-
- 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 {
- #pack::new(args).to_render()
- }
- fn clone_dispatcher(&self) -> Box<dyn ::mingling::Dispatcher> {
- Box::new(#command_struct)
- }
- }
- }
- };
-
- expanded.into()
-}
-
#[cfg(feature = "comp")]
fn get_comp_entry(entry_name: &Ident) -> proc_macro2::TokenStream {
let comp_entry = quote! {