pub fn write_tree_safe<W: Write>(
out: &mut W,
tree: &BTreeMap<String, Box<Tree>>,
depth: usize,
max_depth: usize,
) -> Result<()>Expand description
Writes the tree with indentation based on depth (SAFE RECURSIVE VERSION)
Recursive like write_tree, but a tree deeper than max_depth ends with an error of kind
InvalidInput instead of a stack overflow. The lines up to that depth are written.
The cost of the depth check is measured in the benchmarks (README, section Benchmarks).
ยงArguments
out- Where the lines gotree- The tree to writedepth- Current depth level for indentationmax_depth- Maximum allowed recursion depth (typical: 1000-5000)