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>)
| 51 | /// with the new value if the key is already in the symbol table. |
| 52 | /// If the value is None, this effectively deletes the key from the symbol table. |
| 53 | pub fn put(&mut self, key: &str, val: Option<T>) { |
| 54 | if !self.contains(key) { |
| 55 | self.n += 1; |
| 56 | } else if val.is_none() { |
| 57 | self.n -= 1; |
| 58 | } |
| 59 | unsafe { |
| 60 | self.root = put_dth(self.root, key, val, 0); |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | /// Returns all of the keys in the set that start with prefix. |
| 65 | pub fn keys_with_prefix(&self, prefix: &str) -> Queue<String> { |