macro_rules! add_branch {
() => { ... };
($($arg:tt)*) => { ... };
}
Expand description
Adds a scoped branch to the default tree with the given text and formatting arguments The branch will be exited at the end of the current block.
§Arguments
text...
- Formatted text arguments, as performat!(...)
.
§Example
#[macro_use]
use debug_tree::{default_tree, add_branch, add_leaf};
fn main() {
{
add_branch!("New {}", "Branch"); // _branch enters scope
// tree is now pointed inside new branch.
add_leaf!("Child of {}", "Branch");
// Block ends, so tree exits the current branch.
}
add_leaf!("Sibling of {}", "Branch");
assert_eq!("\
New Branch
└╼ Child of Branch
Sibling of Branch" , &default_tree().string());
}