[][src]Crate deviz

deviz

deviz is a VS Code extension that displays structured program output such as trees and graphs. This crate allows Rust code to produce output that can be read by this extension.

To use this crate, call one of the top level output functions.

These functions take a pane_name argument, which specifies the name of the tab where the output will be displayed. The same output function can be called multiple times with the same pane name, but combining different types of output into the same pane won't work.

The functions each return a builder object that is used for constructing the output. The output data is automatically sent to the VS Code extension when this builder object is dropped.

Examples

let mut tree = deviz::tree("ast");
tree.begin_node();
tree.label("+");
{
    tree.begin_node();
    tree.label("1");
    tree.end_node();
}
{
    tree.begin_node();
    tree.label("2");
    tree.end_node();
}
tree.end_node();

let mut text = deviz::text("types", "x + y");
text.hover_text(0..1, "Int");
text.hover_text(4..5, "Bool");
text.hover_text(0..5, "Error");

Structs

Graph

A builder for directed graph output. Construct using deviz::graph.

Text

A builder for text output. Construct using deviz::text.

Tree

A builder for tree output. Construct using deviz::tree or deviz::text_tree.

Functions

graph

A directed graph. Returns Graph.

text

Text, with the option of adding hover text. Returns Text.

text_tree

A tree, printed as indented text. Returns Tree.

tree

A tree, rendered graphically. Returns Tree.