May 2019
Intermediate to advanced
698 pages
17h 21m
English
Like every B-Tree, inserts are done by first searching a spot to insert, and then applying the split procedure in case the node has more than the expected number of values (or children). Insertion is split into three parts and it starts with the first method to be called, which glues everything together and returns an expected result:
#[stable(feature = "rust1", since = "1.0.0")]pub fn insert(&mut self, key: K, value: V) -> Option<V> { match self.entry(key) { Occupied(mut entry) => Some(entry.insert(value)), Vacant(entry) => { entry.insert(value); None } }}
The second step is finding the handle for the node that the pair can be inserted into, shown as follows:
#[stable(feature = "rust1", since = "1.0.0")]pub fn entry(&mut self, key: ...
Read now
Unlock full access