Closed intendednull closed 5 years ago
Right now the required derive macro is a bit verbose.
#[derive(FromPrimitive, ToPrimitive, Debug, Copy, Clone, PartialEq, Eq)] pub enum UnitTime { Second = 1, Minute = 60, Hour = 3600, Day = 86400, Week = 604800, Month = 2629800, Year = 31557600, }
We should compress it down to something like
#[derive(Unit)] ...
Implementing the Count trait is also trivial.
Count
pub struct Time { pub value: i64, } impl Count for Time { type Unit = UnitTime; fn value(&self) -> i64 { self.value } fn mut_value(&mut self) -> &mut i64 { &mut self.value } }
All we'd need for macro input is the Unit and member to use.
Right now the required derive macro is a bit verbose.
We should compress it down to something like
Implementing the
Count
trait is also trivial.All we'd need for macro input is the Unit and member to use.