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)
| 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 | /// |
no test coverage detected