Returns a reference to value mapped by `key`, if it exists. If the entry exists, it becomes the most recently used.
(&mut self, key: &K)
| 81 | /// Returns a reference to value mapped by `key`, if it exists. |
| 82 | /// If the entry exists, it becomes the most recently used. |
| 83 | pub fn get(&mut self, key: &K) -> Option<&V> { |
| 84 | if let Some(value) = self.remove(key) { |
| 85 | self.put(key.clone(), value); |
| 86 | } |
| 87 | self.data.get(key).map(|(_, value)| value) |
| 88 | } |
| 89 | |
| 90 | /// Returns a reference to value mapped by `key`, if it exists. |
| 91 | /// Does not affect the queue order. |