Crate ramify

Crate ramify 

Source
Expand description

§Ramify

Ramify is a library for generating branch diagrams to visualize hierarchical data.

0       0         0
├╮      ├┬╮       ├┬╮  
1├╮     │1├╮      │1│  
│2│     ││2│      2│╰─╮
│3│     │3││      │╰─╮│
├╮│     │╭╯│      ├┬╮││
4││     ││╭┼╮     │3│││
 5│     │││4│     4╭╯││
╭╯6     ││5╭╯      5╭╯│
7       │6╭╯        6╭╯
        7╭╯          7
         8             

This library is specifically designed for ordered data: this is closer to the output of git log --graph --all than the output of tree. A prototypical application is to visualize the undo-tree of a text file. The order is the timestamp of the edit, and the tree structure results from the undo relation.

Getting started:

  • To describe your hierarchical data, implement Ramify or TryRamify.
  • To generate the branch diagram itself, use the Generator struct.
  • To configure the diagram layout and appearance, use the Config struct or the branch_writer! macro. Read more in the writer module.

§Usage examples

Usage examples can be found in the examples folder on GitHub.

Re-exports§

pub use self::writer::Config;

Modules§

writer
Configuration and styles for writing the branch diagram writer.

Macros§

branch_writer
A macro to generate a custom branch diagram style from a list of box-drawing characters.

Structs§

Generator
A generator which incrementally writes the branch diagram to a writer.
Replacement
A replacement vertex returned when a ramifier fails to determine the children associated with a vertex.

Enums§

WriteVertexError
An error which can occur when calling Generator::try_write_vertex.

Traits§

Ramify
A trait representing hierarchical data structures with efficient iteration of children.
TryRamify
Try to iterate over the children of the vertex.