Returns the value for `key`, if any.
(&self, key: &K)
| 174 | |
| 175 | /// Returns the value for `key`, if any. |
| 176 | pub fn get(&self, key: &K) -> Option<&V> { |
| 177 | match self { |
| 178 | Self::Small(list) => list.iter().find_map(|(k, v)| (k == key).then_some(v)), |
| 179 | Self::Large(map) => map.get(key), |
| 180 | } |
| 181 | } |
| 182 | |
| 183 | /// Returns the value for `key`, mutably, if any. |
| 184 | pub fn get_mut(&mut self, key: &K) -> Option<&mut V> { |