diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-07-11 15:15:12 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-07-11 15:21:40 +0800 |
| commit | 95815041fe2817b4b6bdba6b4f332c90320af7bb (patch) | |
| tree | 224f3479eca9e44caa247132ecab42f8825b167c /examples/example-dispatch-tree | |
| parent | 356879cfd6149bdb235b4e02c0f351a4d2246202 (diff) | |
refactor(examples): migrate renderers to return RenderResult and add
std::io::Write import
Replace r_println!/r_print! macro usage across all example renderers
with
explicit RenderResult construction using std::io::Write, enabling more
flexible output handling and reducing reliance on macro-side effects.
Diffstat (limited to 'examples/example-dispatch-tree')
| -rw-r--r-- | examples/example-dispatch-tree/src/main.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/examples/example-dispatch-tree/src/main.rs b/examples/example-dispatch-tree/src/main.rs index e087b1e..9f76f15 100644 --- a/examples/example-dispatch-tree/src/main.rs +++ b/examples/example-dispatch-tree/src/main.rs @@ -21,6 +21,7 @@ //! use mingling::prelude::*; +use std::io::Write; // --------- IMPORTANT --------- // You have a large number of subcommands @@ -53,8 +54,10 @@ fn main() { /// Renders the confirmation message for the `cmd5` command. #[renderer] -fn render_cmd5(_: Entry5) { - r_println!("It's works!"); +fn render_cmd5(_: Entry5) -> RenderResult { + let mut render_result = RenderResult::new(); + writeln!(render_result, "It's works!").ok(); + render_result } gen_program!(); |
