[−][src]Macro debug_tree::add_branch_to
Adds a scoped branch to given tree with the given text and formatting arguments The branch will be exited at the end of the current block.
Arguments
tree
- The tree that the leaf should be added totext...
- Formatted text arguments, as performat!(...)
.
Example
#[macro_use] use debug_tree::{TreeBuilder, add_branch_to, add_leaf_to}; fn main() { let tree = TreeBuilder::new(); { add_branch_to!(tree, "New {}", "Branch"); // _branch enters scope // tree is now pointed inside new branch. add_leaf_to!(tree, "Child of {}", "Branch"); // Block ends, so tree exits the current branch. } add_leaf_to!(tree, "Sibling of {}", "Branch"); assert_eq!("\ New Branch └╼ Child of Branch Sibling of Branch" , &tree.flush_string()); }