[][src]Struct deviz::Tree

pub struct Tree { /* fields omitted */ }

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

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();

Implementations

impl Tree[src]

pub fn begin_node(&mut self)[src]

Begin a new subtree, i.e. a node and all its children.

A call to this function should be paired with a call to end_node. Between these two calls, the node and its children should be built.

pub fn end_node(&mut self)[src]

End a subtree. See begin_node.

Panics

Panics if there is no matching begin_node call.

pub fn label(&mut self, label: impl Into<String>)[src]

Add a label for the current node. By default, a node has no label.

Panics

This method should be called between a call to begin_node and a call to end_node. Panics otherwise.

Trait Implementations

impl Debug for Tree[src]

impl Drop for Tree[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.