MCPcopy Create free account
hub / github.com/Apress/beginning-rust-2e / count

Method count

Source Code/19-29.rs:24–32  ·  view source on GitHub ↗
(&self, key: u32)

Source from the content-addressed store, hash-verified

22 None
23 }
24 fn count(&self, key: u32) -> usize {
25 let mut c = 0;
26 for record in self.data.iter() {
27 if record.id == key {
28 c += 1;
29 }
30 }
31 c
32 }
33 }
34 fn get_name<D>(dict: &D, id: u32) -> Option<String>
35 where

Callers 3

lengthMethod · 0.45
lengthFunction · 0.45
lengthMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected