macro_rules! path {
($tree:expr , $( $label:literal ),* ) => { ... };
}Expand description
Follow the given label sequence beginning at the root of the specified tree. The resulting index at the end of the label sequence is returned.
ยงExample
use affinitree::{path, tree::graph::{Tree}};
let mut tree = Tree::<(), 2>::new();
let z = tree.add_root(()); // 0
let c0 = tree.add_child_node(z, 0, ()).unwrap(); // 1
let c1 = tree.add_child_node(z, 1, ()).unwrap(); // 2
let l0 = tree.add_child_node(c0, 0, ()).unwrap(); // 3
assert_eq!(path!(tree, 1), 2);
assert_eq!(path!(tree, 0, 0), 3);