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
30
31
32
33
34
mod range_macro;
#[cfg(test)]
mod tests;

#[derive(Debug)]
pub struct Range {
    pub current: i32,
    pub target: i32,
    pub step: i32,
}

impl Iterator for Range {
    type Item = i32;
    fn next(&mut self) -> Option<i32> {
        if self.step > 0 && self.current >= self.target
            || self.step < 0 && self.current <= self.target
        {
            None
        } else {
            let res = self.current;
            self.current += self.step;
            Some(res)
        }
    }
}
#[allow(dead_code)]
impl Range {
    fn is_empty() {
        unimplemented!();
    }
    fn contains() {
        unimplemented!();
    }
}