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

Method inorder

code/chapter07/bst.rs:62–72  ·  view source on GitHub ↗

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

(&self)

Source from the content-addressed store, hash-verified

60
61 // 遍历,使用了 match,使用 unwarp 也可
62 fn inorder(&self) {
63 match &self.left {
64 Some(node) => node.inorder(),
65 None => (),
66 }
67 println!("key:{:?}, value:{:?}", &self.key, &self.val);
68 match &self.right {
69 Some(node) => node.inorder(),
70 None => (),
71 }
72 }
73
74 fn postorder(&self) {
75 match &self.left {

Callers 1

mainFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected