MCPcopy Create free account
hub / github.com/QMHTMY/RustBook / main

Function main

code/chapter07/binary_tree.rs:124–150  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

122}
123
124fn main() {
125 let mut bt = BinaryTree::new('a');
126
127 let root = bt.get_key();
128 println!("root val is {:?}", root);
129
130 bt.insert_left_tree('b');
131 bt.insert_right_tree('c');
132
133 let left = bt.get_left();
134 println!("left child is {:#?}", left);
135 let right = bt.get_left();
136 println!("right child is {:#?}", right);
137
138 bt.preorder();
139 bt.inorder();
140 bt.postorder();
141
142 let nk = Some(Box::new(bt));
143
144 preorder(nk.clone());
145 inorder(nk.clone());
146 postorder(nk.clone());
147
148 let tree_str = get_exp(nk);
149 println!("String expr is {tree_str}");
150}

Callers

nothing calls this directly

Calls 11

get_expFunction · 0.85
preorderFunction · 0.70
inorderFunction · 0.70
postorderFunction · 0.70
get_keyMethod · 0.45
insert_left_treeMethod · 0.45
insert_right_treeMethod · 0.45
get_leftMethod · 0.45
preorderMethod · 0.45
inorderMethod · 0.45
postorderMethod · 0.45

Tested by

no test coverage detected