| 399 | /// Returns the removed value if the key existed, and whether the node is now underfull. |
| 400 | #[inline] |
| 401 | pub fn remove(&mut self, key: &K) -> (Option<V>, bool) { |
| 402 | match self.keys.binary_search(key) { |
| 403 | Ok(index) => { |
| 404 | let removed_value = self.values.remove(index); |
| 405 | self.keys.remove(index); |
| 406 | let is_underfull = self.is_underfull(); |
| 407 | (Some(removed_value), is_underfull) |
| 408 | } |
| 409 | Err(_) => (None, false), // Key not found |
| 410 | } |
| 411 | } |
| 412 | |
| 413 | // ============================================================================ |
| 414 | // STATUS CHECKS |