Method
put_dth
(
&mut self,
x: Option<NonNull<Node<T>>>,
key: &str,
val: Option<T>,
d: usize,
)
Source from the content-addressed store, hash-verified
| 138 | } |
| 139 | |
| 140 | unsafe fn put_dth( |
| 141 | &mut self, |
| 142 | x: Option<NonNull<Node<T>>>, |
| 143 | key: &str, |
| 144 | val: Option<T>, |
| 145 | d: usize, |
| 146 | ) -> Option<NonNull<Node<T>>> { |
| 147 | let mut x = x.unwrap_or_else(|| Node::new(None)); |
| 148 | |
| 149 | if d == key.len() { |
| 150 | if x.as_ref().val.is_none() { |
| 151 | self.n += 1; |
| 152 | } |
| 153 | x.as_mut().val = val; |
| 154 | } else { |
| 155 | let i = common::util::byte_at(key, d); |
| 156 | let next = x.as_ref().next[i]; |
| 157 | x.as_mut().next[i] = self.put_dth(next, key, val, d + 1); |
| 158 | } |
| 159 | |
| 160 | Some(x) |
| 161 | } |
| 162 | |
| 163 | unsafe fn delete_dth( |
| 164 | &mut self, |
Tested by
no test coverage detected