Skip to content

Commit 2131781

Browse files
committed
feat: add size hint
1 parent 526ba75 commit 2131781

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/block_range_scanner/batch_iterator.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,16 @@ impl Iterator for BatchIterator<Reverse> {
123123

124124
Some(batch_low..=batch_high)
125125
}
126+
127+
fn size_hint(&self) -> (usize, Option<usize>) {
128+
let remaining =
129+
usize::try_from(self.total_batches - self.batch_count).unwrap_or(usize::MAX);
130+
(remaining, Some(remaining))
131+
}
126132
}
127133

134+
impl ExactSizeIterator for BatchIterator<Reverse> {}
135+
128136
#[cfg(test)]
129137
mod tests {
130138
use super::*;

0 commit comments

Comments
 (0)