May 2019
Intermediate to advanced
698 pages
17h 21m
English
In a tree structure, inserts and deletes are based on looking up the keys that are being modified. In the case of BTreeMap, this is done by a function called search_tree() which is imported from the parent module:
pub fn search_tree<BorrowType, K, V, Q: ?Sized>( mut node: NodeRef<BorrowType, K, V, marker::LeafOrInternal>, key: &Q) -> SearchResult<BorrowType, K, V, marker::LeafOrInternal, marker::Leaf> where Q: Ord, K: Borrow<Q> { loop { match search_node(node, key) { Found(handle) => return Found(handle), GoDown(handle) => match handle.force() { Leaf(leaf) => return GoDown(leaf), Internal(internal) => { node = internal.descend(); continue; } } } }}pub fn search_node<BorrowType, K, V, Type, Q: ?Sized>( node: NodeRef<BorrowType, K, ...Read now
Unlock full access