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

Method preorder

code/chapter07/bst.rs:55–59  ·  view source on GitHub ↗

遍历,使用了 unwrap,使用 match 也可

(&self)

Source from the content-addressed store, hash-verified

53
54 // 遍历,使用了 unwrap,使用 match 也可
55 fn preorder(&self) {
56 println!("key:{:?}, value:{:?}", &self.key, &self.val);
57 if !self.left.is_none() { self.left.as_ref().unwrap().preorder(); }
58 if !self.right.is_none() { self.right.as_ref().unwrap().preorder(); }
59 }
60
61 // 遍历,使用了 match,使用 unwarp 也可
62 fn inorder(&self) {

Callers 1

mainFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected