MCPcopy Create free account
hub / github.com/QMHTMY/RustBook / get_mut

Method get_mut

publication/code/chapter08/rbtree.rs:287–300  ·  view source on GitHub ↗
(&self, key: &K)

Source from the content-addressed store, hash-verified

285 }
286
287 fn get_mut(&self, key: &K) -> Option<&mut V> {
288 unsafe {
289 let mut node = self.root;
290 while !node.is_null() {
291 node = match (*node).key.cmp(key) {
292 Less => (*node).right,
293 Equal => return Some(&mut (*node).val),
294 Greater => (*node).left,
295 }
296 }
297 }
298
299 None
300 }
301
302 // 数据插入
303 fn insert(&mut self, key: K, val: V) {

Callers 15

peek_mutMethod · 0.45
add_edgeMethod · 0.45
find_province_num_bfsFunction · 0.45
add_edgeMethod · 0.45
build_word_graphFunction · 0.45
word_ladderFunction · 0.45
mainFunction · 0.45
add_edgeMethod · 0.45
course_schedulingFunction · 0.45
find_topological_orderFunction · 0.45
add_edgeMethod · 0.45
search_cityFunction · 0.45

Calls 1

cmpMethod · 0.45

Tested by

no test coverage detected