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:
Cristian Brinza 2024-08-19 13:47:09 +03:00 committed by GitHub
parent d59a7f62f8
commit 2a31fddc0b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 46 additions and 100 deletions

View file

@ -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)`.