mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Auto merge of #18494 - frewsxcv:frewsxcv-size-hint, r=jdm
Implement `size_hint` for more iterators. ``` implement size hint for more iterators because why not we like fast things ``` <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18494) <!-- Reviewable:end -->
This commit is contained in:
commit
bb2030a493
8 changed files with 36 additions and 0 deletions
|
@ -440,4 +440,12 @@ impl<I, J, K, T> Iterator for Choice3<I, J, K>
|
|||
Choice3::Third(ref mut k) => k.next(),
|
||||
}
|
||||
}
|
||||
|
||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||
match *self {
|
||||
Choice3::First(ref i) => i.size_hint(),
|
||||
Choice3::Second(ref j) => j.size_hint(),
|
||||
Choice3::Third(ref k) => k.size_hint(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -487,6 +487,10 @@ impl<I> Iterator for FragmentParsingResult<I>
|
|||
next.remove_self();
|
||||
Some(next)
|
||||
}
|
||||
|
||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||
self.inner.size_hint()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf, JSTraceable, PartialEq)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue