Skip to main content

write_tree

Function write_tree 

Source
pub fn write_tree<W: Write>(
    out: &mut W,
    tree: &BTreeMap<String, Box<Tree>>,
    depth: usize,
) -> Result<()>
Expand description

Writes the tree with indentation based on depth (RECURSIVE VERSION)

Pre-order: a node, then its subtree, then its next sibling. The writer makes the traversal testable and measurable without a console: a Vec<u8> in tests, std::io::sink() in benchmarks.

ยงArguments

  • out - Where the lines go
  • tree - The tree to write
  • depth - Current depth level for indentation