diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-05-24 16:46:45 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-05-24 16:46:45 +0800 |
| commit | 11adad7db1b6202d5366527902c3f0a9fb90654f (patch) | |
| tree | 76ecde96bf98686dfa2d5e9fb00f280794757363 | |
| parent | 13699cfdccc901c2a7d53270f695384134ba2221 (diff) | |
Move entry, route, and program_setup macros to extra_macros feature
Remove these macros from the prelude and gate them behind the
`extra_macros` feature flag. Update examples and documentation
to enable the new feature where these macros are used.
| -rw-r--r-- | CHANGELOG.md | 2 | ||||
| -rw-r--r-- | examples/example-argument-parse/Cargo.toml | 2 | ||||
| -rw-r--r-- | examples/example-custom-pickable/Cargo.toml | 4 | ||||
| -rw-r--r-- | examples/example-setup/Cargo.toml | 2 | ||||
| -rw-r--r-- | examples/example-unit-test/Cargo.toml | 2 | ||||
| -rw-r--r-- | examples/example-unit-test/src/main.rs | 1 | ||||
| -rw-r--r-- | mingling/src/example_docs.rs | 11 | ||||
| -rw-r--r-- | mingling/src/lib.rs | 5 | ||||
| -rw-r--r-- | mling/Cargo.toml | 1 |
9 files changed, 16 insertions, 14 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fcaacf..3a344e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -96,6 +96,8 @@ fn render(prev: Previous) { // Implicitly introduces `__renderer_inner_result` } ``` +5. **\[macros\]** Moved the `entry!`, `route!`, `#[program_setup]` macros into the `extra_macros` feature + --- ### Release 0.1.8 (2026-05-18) diff --git a/examples/example-argument-parse/Cargo.toml b/examples/example-argument-parse/Cargo.toml index 3b06523..89f7544 100644 --- a/examples/example-argument-parse/Cargo.toml +++ b/examples/example-argument-parse/Cargo.toml @@ -7,4 +7,4 @@ edition = "2024" path = "../../mingling" # Enable `parser` features -features = ["parser"] +features = ["parser", "extra_macros"] diff --git a/examples/example-custom-pickable/Cargo.toml b/examples/example-custom-pickable/Cargo.toml index ca97c4a..9102c21 100644 --- a/examples/example-custom-pickable/Cargo.toml +++ b/examples/example-custom-pickable/Cargo.toml @@ -6,6 +6,4 @@ edition = "2024" [dependencies.mingling] path = "../../mingling" -features = [ - "parser", -] +features = ["parser", "extra_macros"] diff --git a/examples/example-setup/Cargo.toml b/examples/example-setup/Cargo.toml index 12364aa..a340c91 100644 --- a/examples/example-setup/Cargo.toml +++ b/examples/example-setup/Cargo.toml @@ -4,4 +4,4 @@ version = "0.1.0" edition = "2024" [dependencies] -mingling = { path = "../../mingling" } +mingling = { path = "../../mingling", features = ["extra_macros"] } diff --git a/examples/example-unit-test/Cargo.toml b/examples/example-unit-test/Cargo.toml index 4a82503..cc9a1a2 100644 --- a/examples/example-unit-test/Cargo.toml +++ b/examples/example-unit-test/Cargo.toml @@ -4,4 +4,4 @@ version = "0.1.0" edition = "2024" [dependencies] -mingling = { path = "../../mingling" } +mingling = { path = "../../mingling", features = ["extra_macros"] } diff --git a/examples/example-unit-test/src/main.rs b/examples/example-unit-test/src/main.rs index d0e1b90..ca7ac25 100644 --- a/examples/example-unit-test/src/main.rs +++ b/examples/example-unit-test/src/main.rs @@ -11,6 +11,7 @@ use mingling::prelude::*; #[cfg(test)] mod tests { use super::*; + use mingling::macros::entry; use mingling::{assert_member_id, assert_render_result}; // --------- IMPORTANT --------- diff --git a/mingling/src/example_docs.rs b/mingling/src/example_docs.rs index 70f2856..9a48596 100644 --- a/mingling/src/example_docs.rs +++ b/mingling/src/example_docs.rs @@ -31,7 +31,7 @@ /// path = "../../mingling" /// /// # Enable `parser` features -/// features = ["parser"] +/// features = ["parser", "extra_macros"] /// ``` /// /// Source code (./src/main.rs) @@ -477,9 +477,7 @@ pub mod example_completion {} /// [dependencies.mingling] /// path = "../../mingling" /// -/// features = [ -/// "parser", -/// ] +/// features = ["parser", "extra_macros"] /// ``` /// /// Source code (./src/main.rs) @@ -1582,7 +1580,7 @@ pub mod example_resources {} /// edition = "2024" /// /// [dependencies] -/// mingling = { path = "../../mingling" } +/// mingling = { path = "../../mingling", features = ["extra_macros"] } /// ``` /// /// Source code (./src/main.rs) @@ -1634,7 +1632,7 @@ pub mod example_setup {} /// edition = "2024" /// /// [dependencies] -/// mingling = { path = "../../mingling" } +/// mingling = { path = "../../mingling", features = ["extra_macros"] } /// ``` /// /// Source code (./src/main.rs) @@ -1644,6 +1642,7 @@ pub mod example_setup {} /// #[cfg(test)] /// mod tests { /// use super::*; +/// use mingling::macros::entry; /// use mingling::{assert_member_id, assert_render_result}; /// /// // --------- IMPORTANT --------- diff --git a/mingling/src/lib.rs b/mingling/src/lib.rs index 583c89a..a7d6896 100644 --- a/mingling/src/lib.rs +++ b/mingling/src/lib.rs @@ -86,6 +86,7 @@ pub mod macros { /// Used to create an empty result value for early return from a chain function pub use mingling_macros::empty_result; /// Creates a packed entry value from a list of string literals + #[cfg(feature = "extra_macros")] pub use mingling_macros::entry; /// Used to collect data and create a command-line context pub use mingling_macros::gen_program; @@ -103,6 +104,7 @@ pub mod macros { /// Internal macro for 'gen_program' used to finally generate the program pub use mingling_macros::program_final_gen; /// Used to generate program setup + #[cfg(feature = "extra_macros")] pub use mingling_macros::program_setup; /// Used to print content within a `Renderer` context pub use mingling_macros::r_print; @@ -121,6 +123,7 @@ pub mod macros { /// Used to generate a struct implementing the `Renderer` trait via a method pub use mingling_macros::renderer; /// Used to generate a route that either returns a successful result or early returns an error. + #[cfg(feature = "extra_macros")] pub use mingling_macros::route; #[cfg(feature = "comp")] /// Used to generate suggestions @@ -218,8 +221,6 @@ pub mod prelude { pub use crate::macros::dispatcher; /// Re-export of the `empty_result` macro for creating an empty result value for early return. pub use crate::macros::empty_result; - /// Re-export of the `entry` macro for creating packed entry values from string literals. - pub use crate::macros::entry; /// Re-export of the `gen_program` macro for generating the program entry point. pub use crate::macros::gen_program; /// Re-export of the `pack` macro for creating wrapper types. diff --git a/mling/Cargo.toml b/mling/Cargo.toml index 4dfa31e..2d01bdf 100644 --- a/mling/Cargo.toml +++ b/mling/Cargo.toml @@ -16,6 +16,7 @@ mingling = { path = "../mingling", features = [ "parser", "comp", "general_renderer", + "extra_macros", ] } serde = { version = "1", features = ["derive"] } |
