Crate text_trees
Simple textual output for tree-like structures.
This crate is another that will output a tree structure in text. Similar to the existing ascii_tree crate, however it is more flexible in its formatting options.
Example
The following creates a StringTreeNode
using a combination of with_child_nodes
and
with_children
that demonstrates the structure of the tree well.
use StringTreeNode;
The tree implements Display
and therefore provides a to_string
method. It also has a
to_string_with_format
method that allows for customization of the output format. Finally, it
has two write methods that take implementations of std::io::Write
and will serialize accordingly.
use ;
This results in a textual representation of the tree as follows.
root
+-- Uncle
+-- Parent
| +-- Child 1
| | '-- Grand Child 1
| '-- Child 2
| '-- Grand Child 2
| '-- Great Grand Child 2
| '-- Great Great Grand Child 2
'-- Aunt
'-- Child 3
Changes
Version 0.1.2
- Documentation changes only.
Version 0.1.1
- Bug in top-down, bottom-anchored, tree with missing spacing.
- Updated all examples to match the tree output changes.
- Added
tls
tree-ls example.
Version 0.1.0
- Initial version, supports only directory style trees.
TODO
TBD