Unverified Commit 84de02c4 authored by Tobias Koppers's avatar Tobias Koppers Committed by GitHub

Turbopack: add size_hint and len for Chunk iterator (#85622)

### What?

add a size hint to the Chunk iterator to allow optimizations
parent 81eccb7e
...@@ -356,6 +356,17 @@ impl<T> Iterator for Chunk<T> { ...@@ -356,6 +356,17 @@ impl<T> Iterator for Chunk<T> {
None None
} }
} }
fn size_hint(&self) -> (usize, Option<usize>) {
let len = self.len();
(len, Some(len))
}
}
impl<T> ExactSizeIterator for Chunk<T> {
fn len(&self) -> usize {
self.end - self.index
}
} }
impl<T> Drop for Chunk<T> { impl<T> Drop for Chunk<T> {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment