Debian Codegraph @

third_party/rust/debug_tree/examples/fibonacci.rs

raw
1 use debug_tree::*;
2
3 fn factors(x: usize) {
4 add_branch!("{}", x); // <~ THE MAGIC LINE
5 for i in 1..x {
6 if x % i == 0 {
7 factors(i);
8 }
9 }
10 }
11
12 fn main() {
13 // output to file at the end of this block
14 defer_write!("examples/out/fibonacci.txt");
15 add_branch!("A Fibonacci Tree");
16 factors(6);
17 add_leaf!("That's All Folks!");
18 }