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

Method leaf_size

publication/code/chapter08/rbtree.rs:92–108  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

90 }
91
92 unsafe fn leaf_size(&self) -> usize {
93 if self.left.is_null() && self.right.is_null() {
94 return 1;
95 }
96
97 let mut left_leaf = 0;
98 if !self.left.is_null() {
99 left_leaf = (*self.left).leaf_size();
100 }
101
102 let mut right_leaf = 0;
103 if !self.right.is_null() {
104 right_leaf = (*self.right).leaf_size();
105 }
106
107 left_leaf + right_leaf
108 }
109
110 unsafe fn none_leaf_size(&self) -> usize {
111 self.size(0) - self.leaf_size()

Callers 1

none_leaf_sizeMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected