mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
Refactor GlyphStore::iter_glyphs_for_byte_range
without recursion (#33074)
* Implement DoubleEndedIterator for EachIndex Signed-off-by: crbrz <cristianb@gmail.com> * Refactor GlyphStore::iter_glyphs_for_byte_range without recursion Signed-off-by: crbrz <cristianb@gmail.com> * Update WPT result Signed-off-by: crbrz <cristianb@gmail.com> * Update WPT legacy result Signed-off-by: crbrz <cristianb@gmail.com> --------- Signed-off-by: crbrz <cristianb@gmail.com>
This commit is contained in:
parent
d59a7f62f8
commit
2a31fddc0b
6 changed files with 46 additions and 100 deletions
|
@ -193,6 +193,19 @@ impl<I: RangeIndex> Iterator for EachIndex<I> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<I: RangeIndex> DoubleEndedIterator for EachIndex<I> {
|
||||
#[inline]
|
||||
fn next_back(&mut self) -> Option<Self::Item> {
|
||||
if self.start < self.stop {
|
||||
let next = self.stop - I::one();
|
||||
self.stop = next;
|
||||
Some(next)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<I: RangeIndex> Range<I> {
|
||||
/// Create a new range from beginning and length offsets. This could be
|
||||
/// denoted as `[begin, begin + length)`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue