orx_iterable/producing_iterables/
range.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use crate::Iterable;
use core::ops::Range;

macro_rules! impl_for_range_of {
    ($T:ty) => {
        impl Iterable for Range<$T> {
            type Item = $T;

            type Iter = Self;

            fn iter(&self) -> Self::Iter {
                self.clone()
            }
        }
    };
}

impl_for_range_of!(usize);
impl_for_range_of!(u128);
impl_for_range_of!(u64);
impl_for_range_of!(u32);
impl_for_range_of!(u16);
impl_for_range_of!(u8);
impl_for_range_of!(isize);
impl_for_range_of!(i128);
impl_for_range_of!(i64);
impl_for_range_of!(i32);
impl_for_range_of!(i16);
impl_for_range_of!(i8);