Impl ExactSizeIterator
for IdxRange
This commit is contained in:
parent
a4966c9282
commit
300f3a1b43
@ -176,9 +176,14 @@ pub fn end(&self) -> Idx<T> {
|
|||||||
|
|
||||||
impl<T> Iterator for IdxRange<T> {
|
impl<T> Iterator for IdxRange<T> {
|
||||||
type Item = Idx<T>;
|
type Item = Idx<T>;
|
||||||
|
|
||||||
fn next(&mut self) -> Option<Self::Item> {
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
self.range.next().map(|raw| Idx::from_raw(raw.into()))
|
self.range.next().map(|raw| Idx::from_raw(raw.into()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||||
|
self.range.size_hint()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> DoubleEndedIterator for IdxRange<T> {
|
impl<T> DoubleEndedIterator for IdxRange<T> {
|
||||||
@ -187,6 +192,8 @@ fn next_back(&mut self) -> Option<Self::Item> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<T> ExactSizeIterator for IdxRange<T> {}
|
||||||
|
|
||||||
impl<T> fmt::Debug for IdxRange<T> {
|
impl<T> fmt::Debug for IdxRange<T> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
f.debug_tuple(&format!("IdxRange::<{}>", std::any::type_name::<T>()))
|
f.debug_tuple(&format!("IdxRange::<{}>", std::any::type_name::<T>()))
|
||||||
|
Loading…
Reference in New Issue
Block a user