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

Method calc_size

publication/code/chapter08/binary_tree.rs:74–85  ·  view source on GitHub ↗
(&self, mut size: usize)

Source from the content-addressed store, hash-verified

72 }
73
74 fn calc_size(&self, mut size: usize) -> usize {
75 size += 1;
76
77 if !self.left.is_none() {
78 size = self.left.as_ref().unwrap().calc_size(size);
79 }
80 if !self.right.is_none() {
81 size = self.right.as_ref().unwrap().calc_size(size);
82 }
83
84 size
85 }
86
87 // 计算叶节点数
88 fn leaf_size(&self) -> usize {

Callers 1

sizeMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected