Consume one candidate position for `line` — pops the first remaining position from the bucket. Used when matching is 1:1 (each old line claims at most one new line, vice versa). Returns `None` if no candidates left.
(&mut self, line: &[u8])
| 84 | /// |
| 85 | /// Returns `None` if no candidates left. |
| 86 | pub fn consume(&mut self, line: &[u8]) -> Option<usize> { |
| 87 | let h = hash_line(line); |
| 88 | if let Some(positions) = self.buckets.get_mut(&h) { |
| 89 | if !positions.is_empty() { |
| 90 | return Some(positions.remove(0)); |
| 91 | } |
| 92 | } |
| 93 | None |
| 94 | } |
| 95 | |
| 96 | /// Number of distinct hash buckets (not total entries). |
| 97 | pub fn bucket_count(&self) -> usize { |