aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-08-03 00:39:54 +0800
committer魏曹先生 <1992414357@qq.com>2026-08-03 00:39:54 +0800
commitb9d5d8e2c442d73245b66c585afde8846c38d9c1 (patch)
tree1b11da7fabcb16b24272c30ee7aa781c25933ef7
parent3668b49c0d3423f1d5d10bb6b4a0e0e7b61f2046 (diff)
feat(build): document build module and refine feature exports
Add module-level docs for the build module via include_str and restrict public re-exports to explicit items instead of glob imports.
-rw-r--r--.run/src/bin/doc.ps12
-rwxr-xr-x.run/src/bin/doc.sh2
-rw-r--r--mingling_core/src/build.rs19
-rw-r--r--mingling_core/src/build/pathf.rs2
-rw-r--r--mingling_core/src/docs/build.md14
-rw-r--r--mingling_core/src/lib.rs15
6 files changed, 36 insertions, 18 deletions
diff --git a/.run/src/bin/doc.ps1 b/.run/src/bin/doc.ps1
index 0e55141..eec3dc5 100644
--- a/.run/src/bin/doc.ps1
+++ b/.run/src/bin/doc.ps1
@@ -1,5 +1,5 @@
cargo doc `
--manifest-path mingling/Cargo.toml `
--no-deps `
- --features docs_rs,core,macros,builds,structural_renderer,repl,comp,parser,picker,clap,extra_macros `
+ --features docs_rs,core,macros,builds,structural_renderer,repl,comp,parser,picker,clap,extra_macros,pathf `
--open
diff --git a/.run/src/bin/doc.sh b/.run/src/bin/doc.sh
index 014ea44..9267a07 100755
--- a/.run/src/bin/doc.sh
+++ b/.run/src/bin/doc.sh
@@ -3,5 +3,5 @@
cargo doc \
--manifest-path mingling/Cargo.toml \
--no-deps \
- --features docs_rs,core,macros,builds,structural_renderer,repl,comp,parser,picker,clap,extra_macros \
+ --features docs_rs,core,macros,builds,structural_renderer,repl,comp,parser,picker,clap,extra_macros,pathf \
--open
diff --git a/mingling_core/src/build.rs b/mingling_core/src/build.rs
index 7918f3a..213d529 100644
--- a/mingling_core/src/build.rs
+++ b/mingling_core/src/build.rs
@@ -3,11 +3,26 @@
mod comp;
#[cfg(feature = "comp")]
-pub use comp::*;
+mod comp_re_export {
+ pub use super::comp::build_comp_script;
+ pub use super::comp::build_comp_script_to;
+ pub use super::comp::build_comp_script_to_file;
+ pub use super::comp::build_comp_scripts;
+}
+
+#[cfg(feature = "comp")]
+pub use comp_re_export::*;
#[doc(hidden)]
#[cfg(feature = "pathf")]
mod pathf;
#[cfg(feature = "pathf")]
-pub use pathf::*;
+mod pathf_re_export {
+ pub use super::pathf::analyze;
+ pub use super::pathf::analyze_and_build_type_mapping;
+ pub use super::pathf::analyze_and_build_type_mapping_for;
+}
+
+#[cfg(feature = "pathf")]
+pub use pathf_re_export::*;
diff --git a/mingling_core/src/build/pathf.rs b/mingling_core/src/build/pathf.rs
index d8d4698..7f75c6b 100644
--- a/mingling_core/src/build/pathf.rs
+++ b/mingling_core/src/build/pathf.rs
@@ -1,3 +1,5 @@
+#![allow(unused_imports)]
+
pub use mingling_pathf::config::*;
pub use mingling_pathf::module_pathf::*;
pub use mingling_pathf::pattern_analyzer::*;
diff --git a/mingling_core/src/docs/build.md b/mingling_core/src/docs/build.md
new file mode 100644
index 0000000..dac3778
--- /dev/null
+++ b/mingling_core/src/docs/build.md
@@ -0,0 +1,14 @@
+Provides Mingling's build script module, used in `build.rs` to provide build-time behavior for certain features.
+
+To use it, add the following to your `Cargo.toml` under `[build-dependencies]`, and enable the features
+that require build-time behavior from the crate:
+
+```toml
+# Cargo.toml
+[build-dependencies.mingling]
+version = "0.3.0"
+features = [
+ "build", # Enable it
+ "comp", # If you need completion-related build-time behavior, enable this as well
+]
+```
diff --git a/mingling_core/src/lib.rs b/mingling_core/src/lib.rs
index b1bfe08..cd42842 100644
--- a/mingling_core/src/lib.rs
+++ b/mingling_core/src/lib.rs
@@ -42,21 +42,8 @@ pub mod core_res {
#[cfg(feature = "comp")]
pub(crate) mod comp;
-/// Provides Mingling's build script module, used in `build.rs` to provide build-time behavior for certain features.
-///
-/// To use it, add the following to your `Cargo.toml` under `[build-dependencies]`, and enable the features
-/// that require build-time behavior from the crate:
-///
-/// ```toml
-/// [build-dependencies.mingling]
-/// version = "0.3.0"
-/// features = [
-/// "build", // Enable it
-/// "comp", // If you need completion-related build-time behavior, enable this as well
-/// ]
-/// ```
#[cfg(feature = "build")]
-#[doc(hidden)]
+#[doc = include_str!("docs/build.md")]
pub mod build;
// Public Modules