Return the index into `dense` of the value corresponding to `key`.
(&self, key: K)
| 124 | |
| 125 | /// Return the index into `dense` of the value corresponding to `key`. |
| 126 | fn index(&self, key: K) -> Option<usize> { |
| 127 | if let Some(idx) = self.sparse.get(key).cloned() { |
| 128 | let idx = idx as usize; |
| 129 | if let Some(entry) = self.dense.get(idx) { |
| 130 | if entry.key() == key { |
| 131 | return Some(idx); |
| 132 | } |
| 133 | } |
| 134 | } |
| 135 | None |
| 136 | } |
| 137 | |
| 138 | /// Return `true` if the map contains a value corresponding to `key`. |
| 139 | pub fn contains_key(&self, key: K) -> bool { |