From 0d3639016ac89ca3c6d7a8d2c8aa3b7656069e4e Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Sun, 24 May 2026 17:18:18 +0800 Subject: Gate extra_macros items behind the feature flag --- mingling_macros/src/lib.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'mingling_macros/src') diff --git a/mingling_macros/src/lib.rs b/mingling_macros/src/lib.rs index 73f2fa5..60fe428 100644 --- a/mingling_macros/src/lib.rs +++ b/mingling_macros/src/lib.rs @@ -33,12 +33,14 @@ mod dispatch_tree_gen; mod dispatcher; #[cfg(feature = "clap")] mod dispatcher_clap; +#[cfg(feature = "extra_macros")] mod entry; mod enum_tag; mod groupped; mod help; mod node; mod pack; +#[cfg(feature = "extra_macros")] mod program_setup; mod render; mod renderer; @@ -224,6 +226,7 @@ pub fn pack(input: TokenStream) -> TokenStream { /// value /// } /// ``` +#[cfg(feature = "extra_macros")] #[proc_macro] pub fn route(input: TokenStream) -> TokenStream { let expr = parse_macro_input!(input as syn::Expr); @@ -273,6 +276,7 @@ pub fn route(input: TokenStream) -> TokenStream { /// /// This works because `EmptyResult` is automatically generated by `gen_program!` /// and implements the necessary trait conversions into `ChainProcess`. +#[cfg(feature = "extra_macros")] #[proc_macro] pub fn empty_result(_input: TokenStream) -> TokenStream { let expanded = quote! { @@ -739,6 +743,7 @@ pub fn completion(attr: TokenStream, item: TokenStream) -> TokenStream { /// - The function must have exactly one parameter of type `&mut Program`. /// - The function must return `()`. /// - The function cannot be async. +#[cfg(feature = "extra_macros")] #[proc_macro_attribute] pub fn program_setup(attr: TokenStream, item: TokenStream) -> TokenStream { program_setup::setup_attr(attr, item) @@ -815,6 +820,7 @@ pub fn dispatcher_clap(attr: TokenStream, item: TokenStream) -> TokenStream { /// /// This is a convenience macro for constructing entry wrapper types (created /// via `pack!` or `dispatcher!`) with test data. +#[cfg(feature = "extra_macros")] #[proc_macro] pub fn entry(input: TokenStream) -> TokenStream { entry::entry(input) -- cgit