遍历,使用了 match,使用 unwarp 也可
(&self)
| 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 { |