Debian Codegraph @

third_party/rust/debug_tree/examples/no_macros.rs

raw
1 use debug_tree::TreeBuilder;
2
3 fn main() {
4 // Make a new tree.
5 let tree = TreeBuilder::new();
6
7 // Add a scoped branch. The next item added will belong to the branch.
8 let mut branch = tree.add_branch("1 Branch");
9
10 // Add a leaf to the current branch
11 tree.add_leaf("1.1 Child");
12
13 // Leave scope early
14 branch.release();
15 tree.add_leaf("2 Sibling");
16 // output to file
17 tree.write("examples/out/no_macros.txt").ok(); // Write and flush.
18 }