Debian Codegraph @

third_party/rust/debug_tree/examples/panic.rs

raw
1 use debug_tree::*;
2
3 fn i_will_panic() {
4 add_branch!("Here are my last words");
5 add_leaf!("Stay calm, and try not to panic");
6 panic!("I told you so...")
7 }
8
9 fn main() {
10 // output to file at the end of this block
11 defer_write!("examples/out/panic.txt");
12 // print at the end of this block
13 {
14 add_branch!("By using the 'defer_' functions");
15 add_branch!("Output will still be generated");
16 add_branch!("Otherwise you might lose your valuable tree!");
17 }
18 add_branch!("Now for something crazy...");
19 i_will_panic();
20 }