1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::int::*;

use std::iter::Step;

impl Step for Int {
    fn steps_between(start: &Self, end: &Self) -> Option<usize> {
        (*end - *start).try_to_usize()
    }

    fn forward_checked(start: Self, count: usize) -> Option<Self> {
        Some(start + count)
    }

    fn backward_checked(start: Self, count: usize) -> Option<Self> {
        Some(start - count)
    }
}