implemented a primitive tree printing

This commit is contained in:
Able 2021-11-30 13:43:03 -06:00
parent c6d8f4ab5b
commit f5e30e15fb

View file

@ -34,7 +34,14 @@ fn main() {
let root_id = tree.root_node_id();
for x in tree.traverse_pre_order(&root_id.unwrap()).unwrap() {
println!("{:?}", x.data());
println!("Parent: {:?}", x.data());
for y in x.children() {
if tree.get(y).unwrap().children().is_empty() {
println!("No Children");
} else {
println!(" Children: {:?}", tree.get(y).unwrap().data());
}
}
}
}