aboutsummaryrefslogtreecommitdiff
path: root/examples/example-pathfinder/src/main.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 /examples/example-pathfinder/src/main.rs
parent748c14588cf1c31c8b8d60a9c94349c0173ef607 (diff)
feat(docs): add Module Pathfinder example for the `pathf` feature
Diffstat (limited to 'examples/example-pathfinder/src/main.rs')
-rw-r--r--examples/example-pathfinder/src/main.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/examples/example-pathfinder/src/main.rs b/examples/example-pathfinder/src/main.rs
new file mode 100644
index 0000000..0f93a8d
--- /dev/null
+++ b/examples/example-pathfinder/src/main.rs
@@ -0,0 +1,30 @@
+//! 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!
+//! ```
+
+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!();