Open vitreo12 opened 1 year ago
Is it possible to remove a slot regardless of the version of the key, but only looking at its idx? Currently, remove is defined as:
idx
remove
pub fn remove(&mut self, key: K) -> Option<V> { let kd = key.data(); if let Some(slot) = self.slots.get_mut(kd.idx as usize) { if slot.version() == kd.version.get() { self.num_elems -= 1; return replace(slot, Slot::new_vacant()).into_option(); } } None }
This function could look something like:
pub fn remove_index(&mut self, key: K) -> Option<V> { let kd = key.data(); if let Some(slot) = self.slots.get_mut(kd.idx as usize) { if slot.occupied() { self.num_elems -= 1; return replace(slot, Slot::new_vacant()).into_option(); } } None }
Is it possible to remove a slot regardless of the version of the key, but only looking at its
idx
? Currently,remove
is defined as:This function could look something like: