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-panic-unwind/src/main.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'examples/example-panic-unwind') diff --git a/examples/example-panic-unwind/src/main.rs b/examples/example-panic-unwind/src/main.rs index ed032c5..a829158 100644 --- a/examples/example-panic-unwind/src/main.rs +++ b/examples/example-panic-unwind/src/main.rs @@ -16,6 +16,7 @@ //! ``` use mingling::{hook::ProgramHook, prelude::*}; +use std::io::Write; dispatcher!("panic", CMDPanic => EntryPanic); pack!(NotPanic = ()); @@ -50,10 +51,13 @@ fn handle_panic(prev: EntryPanic) -> Next { } } +/// Renders the message when no panic occurs. /// Renders the message when no panic occurs. #[renderer] -fn render(_: NotPanic) { - r_println!("Program not panic"); +pub fn render(_: NotPanic) -> RenderResult { + let mut render_result = RenderResult::new(); + writeln!(render_result, "Program not panic").ok(); + render_result } gen_program!(); -- cgit