diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2017-09-02 15:07:33 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2017-09-02 15:07:33 +0200 |
commit | 19500f3988dc6417d417e974d7093fc8f7eb6d1a (patch) | |
tree | e984eae46fbdf2a54a909abf193ad2b95deb9eda | |
parent | 077df7a1a135a2315bad32c99aa027ce690b5ba7 (diff) |
Impl subtraction for TimeType
-rw-r--r-- | src/timetype.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/timetype.rs b/src/timetype.rs index 567ff8a..4e2575e 100644 --- a/src/timetype.rs +++ b/src/timetype.rs @@ -4,6 +4,7 @@ use chrono::NaiveDateTime; use std::ops::Add; +use std::ops::Sub; /// A Type of Time, currently based on chrono::NaiveDateTime #[derive(Debug)] @@ -30,6 +31,14 @@ impl Add for TimeType { } } +impl Sub for TimeType { + type Output = TimeType; + + fn sub(self, rhs: TimeType) -> Self::Output { + TimeType::Subtraction(Box::new(self), Box::new(rhs)) + } +} + #[cfg(test)] mod tests { |