aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/example-repl-basic/Cargo.toml2
-rw-r--r--mingling/src/example_docs.rs2
-rw-r--r--mingling/src/lib.rs2
-rw-r--r--mingling_macros/src/lib.rs6
4 files changed, 10 insertions, 2 deletions
diff --git a/examples/example-repl-basic/Cargo.toml b/examples/example-repl-basic/Cargo.toml
index c358a73..090ac06 100644
--- a/examples/example-repl-basic/Cargo.toml
+++ b/examples/example-repl-basic/Cargo.toml
@@ -5,7 +5,7 @@ edition = "2024"
[dependencies.mingling]
path = "../../mingling"
-features = ["repl", "parser"]
+features = ["repl", "parser", "extra_macros"]
[dependencies]
just_fmt = "0.1.2"
diff --git a/mingling/src/example_docs.rs b/mingling/src/example_docs.rs
index df16cb1..81ba3fc 100644
--- a/mingling/src/example_docs.rs
+++ b/mingling/src/example_docs.rs
@@ -1352,7 +1352,7 @@ pub mod example_panic_unwind {}
///
/// [dependencies.mingling]
/// path = "../../mingling"
-/// features = ["repl", "parser"]
+/// features = ["repl", "parser", "extra_macros"]
///
/// [dependencies]
/// just_fmt = "0.1.2"
diff --git a/mingling/src/lib.rs b/mingling/src/lib.rs
index a7d6896..01aa49e 100644
--- a/mingling/src/lib.rs
+++ b/mingling/src/lib.rs
@@ -84,6 +84,7 @@ pub mod macros {
#[cfg(feature = "clap")]
pub use mingling_macros::dispatcher_clap;
/// Used to create an empty result value for early return from a chain function
+ #[cfg(feature = "extra_macros")]
pub use mingling_macros::empty_result;
/// Creates a packed entry value from a list of string literals
#[cfg(feature = "extra_macros")]
@@ -220,6 +221,7 @@ pub mod prelude {
/// Re-export of the `dispatcher` macro for routing commands.
pub use crate::macros::dispatcher;
/// Re-export of the `empty_result` macro for creating an empty result value for early return.
+ #[cfg(feature = "extra_macros")]
pub use crate::macros::empty_result;
/// Re-export of the `gen_program` macro for generating the program entry point.
pub use crate::macros::gen_program;
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<G>`.
/// - 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)