implemented a primitive tree printing

master
Able 2021-11-30 13:43:03 -06:00
parent 81973f1577
commit 1229d8844a
No known key found for this signature in database
GPG Key ID: 2BB8F62388A6A225
1 changed files with 8 additions and 1 deletions

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