From c846e929a88837094d7a5383a306df1fec56c333 Mon Sep 17 00:00:00 2001 From: troido Date: Fri, 28 Feb 2020 16:41:11 +0100 Subject: more specific types! --- src/timestamp.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/timestamp.rs (limited to 'src/timestamp.rs') diff --git a/src/timestamp.rs b/src/timestamp.rs new file mode 100644 index 0000000..645fb0d --- /dev/null +++ b/src/timestamp.rs @@ -0,0 +1,19 @@ + +use std::ops::{Add, Sub}; + +#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] +pub struct Timestamp(pub i64); + +impl Add for Timestamp { + type Output = Self; + fn add(self, other: i64) -> Self { + Self(self.0 + other) + } +} + +impl Sub for Timestamp { + type Output = Self; + fn sub(self, other: i64) -> Self { + Self(self.0 - other) + } +} -- cgit