MCPcopy Index your code
hub / github.com/QMHTMY/RustBook / len

Method len

publication/code/chapter06/hashmap.rs:24–34  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

22 }
23
24 fn len(&self) -> usize {
25 let mut len = 0;
26 for &d in self.slot.iter() {
27 // 槽中数据不为 0,表示有数据,len 加 1
28 if 0 != d {
29 len += 1;
30 }
31 }
32
33 len
34 }
35
36 fn is_empty(&self) -> bool {
37 let mut empty = true;

Callers 9

interpolation_searchFunction · 0.45
sequential_searchFunction · 0.45
sequential_search_posFunction · 0.45
binary_search1Function · 0.45
binary_search2Function · 0.45
binary_searchFunction · 0.45
exponential_searchFunction · 0.45

Calls 1

iterMethod · 0.45

Tested by

no test coverage detected