generic-tree

Regression License Documentation

This crate provides a very simple, intuitive API for storing data in a tree-like structure.

Example

To get started, add the following to Cargo.toml.

toml generic-tree = "0.1"

```rust,norun use generictree::{Tree, Node};

struct Data;

fn main() {

// Create a root Node
let mut root = Node::new("root", Data);

// Create a tree from it
let mut tree = Tree::init(root);

// Create a child
let child = Node::new("child", Data);

// And add it as a child of `root`
tree.add_node(&["root"], child);

// Get a reference to the child
let child = tree.get_node(&["root", "child"]).unwrap();

} ```