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

Method get

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

Source from the content-addressed store, hash-verified

14 }
15 impl Dictionary<u32, usize> for RecordSet {
16 fn get(&self, key: u32) -> Option<String> {
17 for record in self.data.iter() {
18 if record.id == key {
19 return Some(String::from(&record.name));
20 }
21 }
22 None
23 }
24 fn count(&self, key: u32) -> usize {
25 let mut c = 0;
26 for record in self.data.iter() {

Callers 1

get_nameFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected