Method
record
(&mut self, success: bool)
Source from the content-addressed store, hash-verified
| 161 | self.next |
| 162 | } |
| 163 | fn record(&mut self, success: bool) { |
| 164 | if !success { |
| 165 | self.growing = false |
| 166 | } |
| 167 | let diff = if self.growing { |
| 168 | (self.next - self.last) * 2 |
| 169 | } else { |
| 170 | (self.next - self.last + 1) / 2 |
| 171 | }; |
| 172 | if success { |
| 173 | self.last = self.next; |
| 174 | self.next = self.next + diff; |
| 175 | } else { |
| 176 | self.next = self.next - diff; |
| 177 | } |
| 178 | } |
| 179 | fn done(&self) -> bool { |
| 180 | self.last == self.next |
| 181 | } |
Tested by
no test coverage detected