intendednull / dm-toolkit

Native management tool for tabletop rpgs
0 stars 0 forks source link

Fix #7: Improve Unit Usage #8

Closed intendednull closed 5 years ago

intendednull commented 5 years ago

Removes a lot of boiler plate code for implementing Unit. It still depends on some traits but we should be able to substitute those with an attribute macro.

#[derive(Debug, Copy, Clone, Unit, FromPrimitive, ToPrimitive)]
pub enum UnitTime {
    Second = 1,
    Minute = 60,
    Hour = 3600,
    Day = 86400,
    Week = 604800,
    Month = 2629800,
    Year = 31557600,
}

The Counter struct is not longer used, all of the functionality is moved to the Unit trait.