aboutsummaryrefslogtreecommitdiff
path: root/mingling
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-05-29 20:56:19 +0800
committer魏曹先生 <1992414357@qq.com>2026-05-29 20:56:19 +0800
commit0617ce6a527567f4545558fda632dd8d7e06606d (patch)
tree06479dec6f55d9a46adf0f0ff096340aaefc46b2 /mingling
parent7e9c77641a3dfb5df7c2218081ee625d0d069f4b (diff)
Add auto-generated feature flags module and tooling
Diffstat (limited to 'mingling')
-rw-r--r--mingling/Cargo.toml1
-rw-r--r--mingling/src/example_docs.rs24
-rw-r--r--mingling/src/features.rs225
-rw-r--r--mingling/src/features.rs.tmpl15
-rw-r--r--mingling/src/lib.rs39
5 files changed, 225 insertions, 79 deletions
diff --git a/mingling/Cargo.toml b/mingling/Cargo.toml
index 68a26d4..e0d2f4a 100644
--- a/mingling/Cargo.toml
+++ b/mingling/Cargo.toml
@@ -51,6 +51,7 @@ default = ["mingling_core/default", "mingling_macros/default"]
clap = ["mingling_core/clap", "mingling_macros/clap"]
dispatch_tree = ["mingling_core/dispatch_tree", "mingling_macros/dispatch_tree"]
repl = ["mingling_core/repl", "mingling_macros/repl"]
+repl_extra = ["repl"]
comp = ["mingling_core/comp", "mingling_macros/comp"]
parser = ["dep:size"]
diff --git a/mingling/src/example_docs.rs b/mingling/src/example_docs.rs
index b665485..b46041f 100644
--- a/mingling/src/example_docs.rs
+++ b/mingling/src/example_docs.rs
@@ -1473,6 +1473,30 @@ pub mod example_implicit_dispatcher {}
/// gen_program!();
/// ```
pub mod example_panic_unwind {}
+
+///
+/// Source code (./Cargo.toml)
+/// ```toml
+/// [package]
+/// name = "example-repl-advanced"
+/// version = "0.1.0"
+/// edition = "2024"
+///
+/// [dependencies.mingling]
+/// path = "../../mingling"
+/// features = ["repl", "repl_extra", "parser", "extra_macros"]
+///
+/// [dependencies]
+/// just_fmt = "0.1.2"
+/// ```
+///
+/// Source code (./src/main.rs)
+/// ```ignore
+/// fn main() {
+/// println!("Hello, world!");
+/// }
+/// ```
+pub mod example_repl_advanced {}
/// Example REPL Basic
///
/// > This example demonstrates how to develop a REPL program using the `repl` feature
diff --git a/mingling/src/features.rs b/mingling/src/features.rs
index 7d78012..365724c 100644
--- a/mingling/src/features.rs
+++ b/mingling/src/features.rs
@@ -1,77 +1,220 @@
-#[cfg(not(feature = "nightly"))]
-pub const MINGLING_NIGHTLY: bool = false;
-
-#[cfg(feature = "nightly")]
-pub const MINGLING_NIGHTLY: bool = true;
-
-#[cfg(not(feature = "debug"))]
-pub const MINGLING_DEBUG: bool = false;
-
-#[cfg(feature = "debug")]
-pub const MINGLING_DEBUG: bool = true;
-
+/// Whether the `all_serde_fmt` feature is enabled
+/// Current: `disabled`
+#[cfg(not(feature = "all_serde_fmt"))]
+#[allow(unused)]
+pub const MINGLING_ALL_SERDE_FMT: bool = false;
+
+/// Whether the `all_serde_fmt` feature is enabled
+/// Current: `enabled`
+#[cfg(feature = "all_serde_fmt")]
+#[allow(unused)]
+pub const MINGLING_ALL_SERDE_FMT: bool = true;
+/// Whether the `async` feature is enabled
+/// Current: `disabled`
#[cfg(not(feature = "async"))]
+#[allow(unused)]
pub const MINGLING_ASYNC: bool = false;
+/// Whether the `async` feature is enabled
+/// Current: `enabled`
#[cfg(feature = "async")]
+#[allow(unused)]
pub const MINGLING_ASYNC: bool = true;
-
+/// Whether the `builds` feature is enabled
+/// Current: `disabled`
+#[cfg(not(feature = "builds"))]
+#[allow(unused)]
+pub const MINGLING_BUILDS: bool = false;
+
+/// Whether the `builds` feature is enabled
+/// Current: `enabled`
+#[cfg(feature = "builds")]
+#[allow(unused)]
+pub const MINGLING_BUILDS: bool = true;
+/// Whether the `clap` feature is enabled
+/// Current: `disabled`
#[cfg(not(feature = "clap"))]
+#[allow(unused)]
pub const MINGLING_CLAP: bool = false;
+/// Whether the `clap` feature is enabled
+/// Current: `enabled`
#[cfg(feature = "clap")]
+#[allow(unused)]
pub const MINGLING_CLAP: bool = true;
+/// Whether the `comp` feature is enabled
+/// Current: `disabled`
+#[cfg(not(feature = "comp"))]
+#[allow(unused)]
+pub const MINGLING_COMP: bool = false;
+/// Whether the `comp` feature is enabled
+/// Current: `enabled`
+#[cfg(feature = "comp")]
+#[allow(unused)]
+pub const MINGLING_COMP: bool = true;
+/// Whether the `debug` feature is enabled
+/// Current: `disabled`
+#[cfg(not(feature = "debug"))]
+#[allow(unused)]
+pub const MINGLING_DEBUG: bool = false;
+
+/// Whether the `debug` feature is enabled
+/// Current: `enabled`
+#[cfg(feature = "debug")]
+#[allow(unused)]
+pub const MINGLING_DEBUG: bool = true;
+/// Whether the `default` feature is enabled
+/// Current: `disabled`
+#[cfg(not(feature = "default"))]
+#[allow(unused)]
+pub const MINGLING_DEFAULT: bool = false;
+
+/// Whether the `default` feature is enabled
+/// Current: `enabled`
+#[cfg(feature = "default")]
+#[allow(unused)]
+pub const MINGLING_DEFAULT: bool = true;
+/// Whether the `dispatch_tree` feature is enabled
+/// Current: `disabled`
#[cfg(not(feature = "dispatch_tree"))]
+#[allow(unused)]
pub const MINGLING_DISPATCH_TREE: bool = false;
+/// Whether the `dispatch_tree` feature is enabled
+/// Current: `enabled`
#[cfg(feature = "dispatch_tree")]
+#[allow(unused)]
pub const MINGLING_DISPATCH_TREE: bool = true;
-
+/// Whether the `extra_macros` feature is enabled
+/// Current: `disabled`
+#[cfg(not(feature = "extra_macros"))]
+#[allow(unused)]
+pub const MINGLING_EXTRA_MACROS: bool = false;
+
+/// Whether the `extra_macros` feature is enabled
+/// Current: `enabled`
+#[cfg(feature = "extra_macros")]
+#[allow(unused)]
+pub const MINGLING_EXTRA_MACROS: bool = true;
+/// Whether the `general_renderer` feature is enabled
+/// Current: `disabled`
#[cfg(not(feature = "general_renderer"))]
+#[allow(unused)]
pub const MINGLING_GENERAL_RENDERER: bool = false;
+/// Whether the `general_renderer` feature is enabled
+/// Current: `enabled`
#[cfg(feature = "general_renderer")]
+#[allow(unused)]
pub const MINGLING_GENERAL_RENDERER: bool = true;
+/// Whether the `general_renderer_empty` feature is enabled
+/// Current: `disabled`
+#[cfg(not(feature = "general_renderer_empty"))]
+#[allow(unused)]
+pub const MINGLING_GENERAL_RENDERER_EMPTY: bool = false;
+
+/// Whether the `general_renderer_empty` feature is enabled
+/// Current: `enabled`
+#[cfg(feature = "general_renderer_empty")]
+#[allow(unused)]
+pub const MINGLING_GENERAL_RENDERER_EMPTY: bool = true;
+/// Whether the `general_renderer_full` feature is enabled
+/// Current: `disabled`
+#[cfg(not(feature = "general_renderer_full"))]
+#[allow(unused)]
+pub const MINGLING_GENERAL_RENDERER_FULL: bool = false;
+
+/// Whether the `general_renderer_full` feature is enabled
+/// Current: `enabled`
+#[cfg(feature = "general_renderer_full")]
+#[allow(unused)]
+pub const MINGLING_GENERAL_RENDERER_FULL: bool = true;
+/// Whether the `json_serde_fmt` feature is enabled
+/// Current: `disabled`
+#[cfg(not(feature = "json_serde_fmt"))]
+#[allow(unused)]
+pub const MINGLING_JSON_SERDE_FMT: bool = false;
-#[cfg(not(feature = "repl"))]
-pub const MINGLING_REPL: bool = false;
-
-#[cfg(feature = "repl")]
-pub const MINGLING_REPL: bool = true;
-
-#[cfg(not(feature = "comp"))]
-pub const MINGLING_COMP: bool = false;
-
-#[cfg(feature = "comp")]
-pub const MINGLING_COMP: bool = true;
+/// Whether the `json_serde_fmt` feature is enabled
+/// Current: `enabled`
+#[cfg(feature = "json_serde_fmt")]
+#[allow(unused)]
+pub const MINGLING_JSON_SERDE_FMT: bool = true;
+/// Whether the `nightly` feature is enabled
+/// Current: `disabled`
+#[cfg(not(feature = "nightly"))]
+#[allow(unused)]
+pub const MINGLING_NIGHTLY: bool = false;
+/// Whether the `nightly` feature is enabled
+/// Current: `enabled`
+#[cfg(feature = "nightly")]
+#[allow(unused)]
+pub const MINGLING_NIGHTLY: bool = true;
+/// Whether the `parser` feature is enabled
+/// Current: `disabled`
#[cfg(not(feature = "parser"))]
+#[allow(unused)]
pub const MINGLING_PARSER: bool = false;
+/// Whether the `parser` feature is enabled
+/// Current: `enabled`
#[cfg(feature = "parser")]
+#[allow(unused)]
pub const MINGLING_PARSER: bool = true;
+/// Whether the `repl` feature is enabled
+/// Current: `disabled`
+#[cfg(not(feature = "repl"))]
+#[allow(unused)]
+pub const MINGLING_REPL: bool = false;
-#[cfg(not(feature = "json_serde_fmt"))]
-pub const MINGLING_JSON_SERDE_FMT: bool = false;
-
-#[cfg(feature = "json_serde_fmt")]
-pub const MINGLING_JSON_SERDE_FMT: bool = true;
-
-#[cfg(not(feature = "yaml_serde_fmt"))]
-pub const MINGLING_YAML_SERDE_FMT: bool = false;
-
-#[cfg(feature = "yaml_serde_fmt")]
-pub const MINGLING_YAML_SERDE_FMT: bool = true;
+/// Whether the `repl` feature is enabled
+/// Current: `enabled`
+#[cfg(feature = "repl")]
+#[allow(unused)]
+pub const MINGLING_REPL: bool = true;
+/// Whether the `repl_extra` feature is enabled
+/// Current: `disabled`
+#[cfg(not(feature = "repl_extra"))]
+#[allow(unused)]
+pub const MINGLING_REPL_EXTRA: bool = false;
+
+/// Whether the `repl_extra` feature is enabled
+/// Current: `enabled`
+#[cfg(feature = "repl_extra")]
+#[allow(unused)]
+pub const MINGLING_REPL_EXTRA: bool = true;
+/// Whether the `ron_serde_fmt` feature is enabled
+/// Current: `disabled`
+#[cfg(not(feature = "ron_serde_fmt"))]
+#[allow(unused)]
+pub const MINGLING_RON_SERDE_FMT: bool = false;
+/// Whether the `ron_serde_fmt` feature is enabled
+/// Current: `enabled`
+#[cfg(feature = "ron_serde_fmt")]
+#[allow(unused)]
+pub const MINGLING_RON_SERDE_FMT: bool = true;
+/// Whether the `toml_serde_fmt` feature is enabled
+/// Current: `disabled`
#[cfg(not(feature = "toml_serde_fmt"))]
+#[allow(unused)]
pub const MINGLING_TOML_SERDE_FMT: bool = false;
+/// Whether the `toml_serde_fmt` feature is enabled
+/// Current: `enabled`
#[cfg(feature = "toml_serde_fmt")]
+#[allow(unused)]
pub const MINGLING_TOML_SERDE_FMT: bool = true;
+/// Whether the `yaml_serde_fmt` feature is enabled
+/// Current: `disabled`
+#[cfg(not(feature = "yaml_serde_fmt"))]
+#[allow(unused)]
+pub const MINGLING_YAML_SERDE_FMT: bool = false;
-#[cfg(not(feature = "ron_serde_fmt"))]
-pub const MINGLING_RON_SERDE_FMT: bool = false;
-
-#[cfg(feature = "ron_serde_fmt")]
-pub const MINGLING_RON_SERDE_FMT: bool = true;
+/// Whether the `yaml_serde_fmt` feature is enabled
+/// Current: `enabled`
+#[cfg(feature = "yaml_serde_fmt")]
+#[allow(unused)]
+pub const MINGLING_YAML_SERDE_FMT: bool = true;
diff --git a/mingling/src/features.rs.tmpl b/mingling/src/features.rs.tmpl
new file mode 100644
index 0000000..3447041
--- /dev/null
+++ b/mingling/src/features.rs.tmpl
@@ -0,0 +1,15 @@
+>>>>>>>>>> features
+
+@@@ >>> features
+/// Whether the `<<<feat_name>>>` feature is enabled
+/// Current: `disabled`
+#[cfg(not(feature = "<<<feat_name>>>"))]
+#[allow(unused)]
+pub const MINGLING_<<<feat_const_name>>>: bool = false;
+
+/// Whether the `<<<feat_name>>>` feature is enabled
+/// Current: `enabled`
+#[cfg(feature = "<<<feat_name>>>")]
+#[allow(unused)]
+pub const MINGLING_<<<feat_const_name>>>: bool = true;
+@@@ <<<
diff --git a/mingling/src/lib.rs b/mingling/src/lib.rs
index 83fd64e..ee01fb7 100644
--- a/mingling/src/lib.rs
+++ b/mingling/src/lib.rs
@@ -155,44 +155,7 @@ mod features;
/// They can be used for conditional compilation or runtime branching based on
/// feature availability.
pub mod feature {
- /// Whether the `async` feature is enabled
- pub use crate::features::MINGLING_ASYNC;
-
- /// Whether the `clap` feature is enabled
- pub use crate::features::MINGLING_CLAP;
-
- /// Whether the `comp` feature is enabled
- pub use crate::features::MINGLING_COMP;
-
- /// Whether the `debug` feature is enabled
- pub use crate::features::MINGLING_DEBUG;
-
- /// Whether the `dispatch_tree` feature is enabled
- pub use crate::features::MINGLING_DISPATCH_TREE;
-
- /// Whether the `general_renderer` feature is enabled
- pub use crate::features::MINGLING_GENERAL_RENDERER;
-
- /// Whether the `nightly` feature is enabled
- pub use crate::features::MINGLING_NIGHTLY;
-
- /// Whether the `parser` feature is enabled
- pub use crate::features::MINGLING_PARSER;
-
- /// Whether the `repl` feature is enabled
- pub use crate::features::MINGLING_REPL;
-
- /// Whether the `json_serde_fmt` feature is enabled
- pub use crate::features::MINGLING_JSON_SERDE_FMT;
-
- /// Whether the `ron_serde_fmt` feature is enabled
- pub use crate::features::MINGLING_RON_SERDE_FMT;
-
- /// Whether the `toml_serde_fmt` feature is enabled
- pub use crate::features::MINGLING_TOML_SERDE_FMT;
-
- /// Whether the `yaml_serde_fmt` feature is enabled
- pub use crate::features::MINGLING_YAML_SERDE_FMT;
+ include!("./features.rs");
}
mod setups;