diff options
-rw-r--r-- | src/timetype.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/timetype.rs b/src/timetype.rs index a895ea1..5df7c23 100644 --- a/src/timetype.rs +++ b/src/timetype.rs @@ -4,7 +4,9 @@ use chrono::NaiveDateTime; use std::ops::Add; +use std::ops::AddAssign; use std::ops::Sub; +use std::ops::SubAssign; use result::Result; use error::KairosErrorKind as KEK; @@ -30,6 +32,12 @@ impl Add for TimeType { } } +impl AddAssign for TimeType { + fn add_assign(&mut self, rhs: TimeType) { + *self = TimeType::Addition(Box::new(self.clone()), Box::new(rhs)); + } +} + impl Sub for TimeType { type Output = TimeType; @@ -38,6 +46,12 @@ impl Sub for TimeType { } } +impl SubAssign for TimeType { + fn sub_assign(&mut self, rhs: TimeType) { + *self = TimeType::Subtraction(Box::new(self.clone()), Box::new(rhs)); + } +} + /// The TimeType type /// /// # Warning |