May 2019
Intermediate to advanced
698 pages
17h 21m
English
The remove function looks a lot like the search function, shown as follows:
#[stable(feature = "rust1", since = "1.0.0")]pub fn remove<Q: ?Sized>(&mut self, k: &Q) -> Option<V> where K: Borrow<Q>, Q: Hash + Eq{ self.search_mut(k).map(|bucket| pop_internal(bucket).1)}
There is one major difference: search returns a mutable bucket from which the key can be removed (or rather, the entire bucket since it's now empty). HashMap turns out to be an impressive piece of code; can BTreeMap compete?
Read now
Unlock full access