Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 300f3a1

Browse files
committed
Impl ExactSizeIterator for IdxRange
1 parent a4966c9 commit 300f3a1

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/la-arena/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,14 @@ impl<T> IdxRange<T> {
176176

177177
impl<T> Iterator for IdxRange<T> {
178178
type Item = Idx<T>;
179+
179180
fn next(&mut self) -> Option<Self::Item> {
180181
self.range.next().map(|raw| Idx::from_raw(raw.into()))
181182
}
183+
184+
fn size_hint(&self) -> (usize, Option<usize>) {
185+
self.range.size_hint()
186+
}
182187
}
183188

184189
impl<T> DoubleEndedIterator for IdxRange<T> {
@@ -187,6 +192,8 @@ impl<T> DoubleEndedIterator for IdxRange<T> {
187192
}
188193
}
189194

195+
impl<T> ExactSizeIterator for IdxRange<T> {}
196+
190197
impl<T> fmt::Debug for IdxRange<T> {
191198
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
192199
f.debug_tuple(&format!("IdxRange::<{}>", std::any::type_name::<T>()))

0 commit comments

Comments
 (0)