implemented a primitive tree printing
This commit is contained in:
parent
c6d8f4ab5b
commit
f5e30e15fb
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue