Generic Node - Branch Tree library
This library is still WIP (Work In Progress). Documentation and tests are partial, but the main module is covered, which presents the general Tree usages and functions provided by the various modules.
The motivation behind NB-Tree is the need for tree data manipulation for the ReTracer project (available on crates.io. The project is not usable just yet, but it is currently in active development).
Please see the library documentation for more information on its purpose and usage.
Quick showcase example
use Tree;
let mut tree1: = new;
// quickly insert nodes
tree1
.i
.i
.i
.i
.i;
let mut tree2: = new;
tree2
.i
.i
.i
.i
.i;
let tree2_orig = tree2.clone;
// Create tree diffs which are also trees
let diff = tree1.diff;
// Combine trees
const OVERWRITE: bool = false;
tree2.combine;
// Navigate trees
let mut node = tree2.root_entry_mut;
node.move_down;
println!;
// Modify trees
node.move_down_branch;
println!;
let mut value_at_abw: &mut usize = node.or_insert; // creates a new node and returns a reference to its value
println!; // prints 110
value_at_abw = node.or_insert; // retrieves the existing node's value
println!; // prints 110
node.move_up;
node.remove_subtree; // removes the "/a" subtree
// Entries are convenient, but one can insert and remove nodes directly too
tree2.insert.unwrap;
tree2.remove_subtree.unwrap;
// Iterate on the tree
println!;
let values: = tree2.iter.map.cloned.collect;
println!;
let tuples: = tree2
.into_iter
.map
.collect;
println!;
// Apply tree diffs
tree1.apply.unwrap;
// (making tree1 equal to the original tree2 in this example)
assert_eq!;
// and more!