MCPcopy Create free account
hub / github.com/douchuan/algorithm / put

Method put

src/strings/tries.rs:88–96  ·  view source on GitHub ↗

Inserts the key-value pair into the symbol table, overwriting the old value with the new value if the key is already in the symbol table. If the value is None, this effectively deletes the key from the symbol table.

(&mut self, key: &str, val: Option<T>)

Source from the content-addressed store, hash-verified

86 /// symbol table. If the value is None, this effectively
87 /// deletes the key from the symbol table.
88 pub fn put(&mut self, key: &str, val: Option<T>) {
89 if val.is_none() {
90 self.delete(key);
91 } else {
92 let mut root = self.root;
93 root = unsafe { self.put_dth(root, key, val, 0) };
94 self.root = root;
95 }
96 }
97
98 /// Removes the key from the set if the key is present
99 pub fn delete(&mut self, key: &str) {

Callers

nothing calls this directly

Calls 3

is_noneMethod · 0.80
put_dthMethod · 0.80
deleteMethod · 0.45

Tested by

no test coverage detected