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

Method get_mut

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

Source from the content-addressed store, hash-verified

99 }
100
101 fn get_mut(&mut self, key: &K) -> Option<&mut V> {
102 if self.contains(key) {
103 self.access(key);
104 }
105
106 let entries = &mut self.entries;
107 self.map.get(key).and_then(move |&i| {
108 entries[i].val.as_mut()
109 })
110 }
111
112 fn contains(&mut self, key: &K) -> bool {
113 self.map.contains_key(key)

Callers 1

remove_from_listMethod · 0.45

Calls 3

containsMethod · 0.45
accessMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected