aboutsummaryrefslogtreecommitdiff
path: root/mingling/src/example_docs.rs
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-06-28 09:18:17 +0800
committer魏曹先生 <1992414357@qq.com>2026-06-28 09:18:17 +0800
commit86bc9000c5687db6434a5d20f409dda8b1d7a43a (patch)
treec28cb62dee7ad1a81abf9345e16b725866fbce7a /mingling/src/example_docs.rs
parent748c14588cf1c31c8b8d60a9c94349c0173ef607 (diff)
feat(docs): add Module Pathfinder example for the `pathf` feature
Diffstat (limited to 'mingling/src/example_docs.rs')
-rw-r--r--mingling/src/example_docs.rs63
1 files changed, 63 insertions, 0 deletions
diff --git a/mingling/src/example_docs.rs b/mingling/src/example_docs.rs
index 5208077..2d2e61c 100644
--- a/mingling/src/example_docs.rs
+++ b/mingling/src/example_docs.rs
@@ -1831,6 +1831,69 @@ pub mod example_pack_err {}
/// gen_program!();
/// ```
pub mod example_panic_unwind {}
+/// Example: Module Pathfinder (pathf)
+///
+/// > This example demonstrates how to use the `pathf` feature to define types
+/// > in submodules without needing explicit `use` in the main module.
+/// > All type paths are resolved automatically at build time.
+///
+/// Run:
+/// ```bash
+/// cargo run --manifest-path examples/example-pathfinder/Cargo.toml --quiet -- greet
+/// cargo run --manifest-path examples/example-pathfinder/Cargo.toml --quiet -- greet Alice
+/// ```
+///
+/// Output:
+/// ```plaintext
+/// Hello, World!
+/// Hello, Alice!
+/// ```
+///
+/// Source code (./Cargo.toml)
+/// ```toml
+/// [package]
+/// name = "example-pathfinder"
+/// version = "0.1.0"
+/// edition = "2024"
+///
+/// [dependencies.mingling]
+/// path = "../../mingling"
+///
+/// features = [
+/// # Enable `pathf` features
+/// "pathf",
+/// ]
+///
+/// [build-dependencies.mingling]
+/// path = "../../mingling"
+///
+/// features = [
+/// # Enable `pathf` features
+/// "pathf",
+///
+/// # Enable the `builds` feature for build-time support
+/// "builds",
+/// ]
+///
+/// [workspace]
+/// ```
+///
+/// Source code (./src/main.rs)
+/// ```ignore
+/// mod sub;
+///
+/// use mingling::macros::gen_program;
+/// use crate::sub::CMDGreet;
+///
+/// fn main() {
+/// let mut program = ThisProgram::new();
+/// program.with_dispatcher(CMDGreet);
+/// program.exec_and_exit();
+/// }
+///
+/// gen_program!();
+/// ```
+pub mod example_pathfinder {}
/// Example REPL Basic
///
/// > This example demonstrates how to develop a REPL program using the `repl` feature