From 95815041fe2817b4b6bdba6b4f332c90320af7bb Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Sat, 11 Jul 2026 15:15:12 +0800 Subject: 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. --- examples/example-combine-pathf-dispatch-tree/src/sub/mod.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'examples/example-combine-pathf-dispatch-tree') diff --git a/examples/example-combine-pathf-dispatch-tree/src/sub/mod.rs b/examples/example-combine-pathf-dispatch-tree/src/sub/mod.rs index e0b7743..5ab0ece 100644 --- a/examples/example-combine-pathf-dispatch-tree/src/sub/mod.rs +++ b/examples/example-combine-pathf-dispatch-tree/src/sub/mod.rs @@ -1,5 +1,6 @@ use crate::Next; -use mingling::{macros::r_println, prelude::*}; +use mingling::prelude::*; +use std::io::Write; dispatcher!("hello"); @@ -17,6 +18,8 @@ pub fn handle_my(args: EntryHello) -> Next { } #[renderer] -pub fn render_my(msg: ResultMessage) { - r_println!("Hello, {}!", *msg); +pub fn render_my(msg: ResultMessage) -> RenderResult { + let mut render_result = RenderResult::new(); + writeln!(render_result, "Hello, {}!", *msg).ok(); + render_result } -- cgit