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

Method get

publication/code/chapter10/lru.rs:90–99  ·  view source on GitHub ↗
(&mut self, key: &K)

Source from the content-addressed store, hash-verified

88 }
89
90 fn get(&mut self, key: &K) -> Option<&V> {
91 if self.contains(key) {
92 self.access(key);
93 }
94
95 let entries = &self.entries;
96 self.map.get(key).and_then(move |&i| {
97 entries[i].val.as_ref()
98 })
99 }
100
101 fn get_mut(&mut self, key: &K) -> Option<&mut V> {
102 if self.contains(key) {

Callers 4

get_mutMethod · 0.45
accessMethod · 0.45
block_infoMethod · 0.45
block_infoMethod · 0.45

Calls 2

containsMethod · 0.45
accessMethod · 0.45

Tested by

no test coverage detected