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

Method remove

publication/code/chapter10/conshash.rs:78–84  ·  view source on GitHub ↗

删除一个结点

(&mut self, node: &T)

Source from the content-addressed store, hash-verified

76
77 // 删除一个结点
78 fn remove(&mut self, node: &T) {
79 assert!(!self.ring.is_empty());
80 for i in 0..self.replicas {
81 let key = hash(&(node.to_string() + &i.to_string()));
82 self.ring.remove(&key);
83 }
84 }
85
86 // 获取结点
87 fn get(&self, key: u64) -> Option<&T> {

Callers 2

remove_multiMethod · 0.45
mainFunction · 0.45

Calls 2

hashFunction · 0.70
to_stringMethod · 0.45

Tested by

no test coverage detected