Remove the element at `k`, if it exists, replacing it with the default value.
(&mut self, k: K)
| 131 | /// Remove the element at `k`, if it exists, replacing it with the default |
| 132 | /// value. |
| 133 | pub fn remove(&mut self, k: K) -> Option<V> { |
| 134 | let i = k.index(); |
| 135 | if i < self.elems.len() { |
| 136 | let default = self.default.clone(); |
| 137 | Some(core::mem::replace(&mut self.elems[i], default)) |
| 138 | } else { |
| 139 | None |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | /// Is this map completely empty? |
| 144 | #[inline(always)] |