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

Method add

publication/code/chapter10/conshash.rs:61–66  ·  view source on GitHub ↗

插入一个结点

(&mut self, node: &T)

Source from the content-addressed store, hash-verified

59
60 // 插入一个结点
61 fn add(&mut self, node: &T) {
62 for i in 0..self.replicas {
63 let key = hash(&(node.to_string()+&i.to_string()));
64 self.ring.insert(key, node.clone());
65 }
66 }
67
68 // 批量删除结点
69 fn remove_multi(&mut self, nodes: &[T]) {

Callers 2

add_multiMethod · 0.45
mainFunction · 0.45

Calls 3

hashFunction · 0.70
to_stringMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected