From 86bc9000c5687db6434a5d20f409dda8b1d7a43a Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Sun, 28 Jun 2026 09:18:17 +0800 Subject: feat(docs): add Module Pathfinder example for the `pathf` feature --- examples/example-pathfinder/src/main.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 examples/example-pathfinder/src/main.rs (limited to 'examples/example-pathfinder/src/main.rs') 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!(); -- cgit