aboutsummaryrefslogtreecommitdiff
path: root/src/number.rs
blob: a71399c05e74446e2095d492591eaf79bc04adf8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#[derive(Clone)]
pub struct Number {
    pub integer_part: String,
    pub fractional_part: String,
}

macro_rules! int_conv {
    ($($t:ty),*) => {$(
        impl From<$t> for Number {
            fn from(x: $t) -> Number {
                Number {
                    integer_part: x.to_string(),
                    fractional_part: "".to_string(),
                }
            }
        }
    )*};
}

int_conv!(u8, u16, u32, u64, usize, i8, i16, i32, i64, isize);