MCPcopy Create free account
hub / github.com/KentBeck/BPlusTree3 / get

Method get

rust/src/get_operations.rs:34–40  ·  view source on GitHub ↗

Get a reference to the value associated with a key. # Arguments `key` - The key to look up # Returns A reference to the value if the key exists, `None` otherwise. # Examples ``` use bplustree::BPlusTreeMap; let mut tree = BPlusTreeMap::new(16).unwrap(); tree.insert(1, "one"); assert_eq!(tree.get(&1), Some(&"one")); assert_eq!(tree.get(&2), None); ```

(&self, key: &K)

Source from the content-addressed store, hash-verified

32 /// assert_eq!(tree.get(&2), None);
33 /// ```
34 pub fn get(&self, key: &K) -> Option<&V> {
35 let (leaf_id, index, matched) = self.find_leaf_for_key_with_match(key)?;
36 if !matched {
37 return None;
38 }
39 self.get_leaf(leaf_id)?.get_value(index)
40 }
41
42 /// Check if key exists in the tree.
43 ///

Callers 8

contains_keyMethod · 0.45
get_or_defaultMethod · 0.45
get_itemMethod · 0.45
try_getMethod · 0.45
get_manyMethod · 0.45
get_child_for_keyMethod · 0.45
get_leafMethod · 0.45
get_branchMethod · 0.45

Calls 3

get_valueMethod · 0.80
get_leafMethod · 0.80

Tested by

no test coverage detected