summaryrefslogtreecommitdiffstats
path: root/src/indicator.rs
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2017-09-16 16:00:27 +0200
committerMatthias Beyer <mail@beyermatthias.de>2017-09-16 16:00:32 +0200
commit6b9d1d0d37159720f23e4916e29f6f17841ff231 (patch)
tree09e99ac5bbd7c0cf69ef4349b71543167f9d482e /src/indicator.rs
parent93418a6a5b70d5c0dcf1b509fa54d675558196da (diff)
Add types to check whether TT::Moment is weekday / in month
Diffstat (limited to 'src/indicator.rs')
-rw-r--r--src/indicator.rs59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/indicator.rs b/src/indicator.rs
new file mode 100644
index 0000000..7a57b7e
--- /dev/null
+++ b/src/indicator.rs
@@ -0,0 +1,59 @@
+#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Debug)]
+pub enum Day {
+ Monday,
+ Tuesday,
+ Wednesday,
+ Thursday,
+ Friday,
+ Saturday,
+ Sunday,
+}
+
+impl Into<::chrono::Weekday> for Day {
+ fn into(self) -> ::chrono::Weekday {
+ match self {
+ Day::Monday => ::chrono::Weekday::Mon,
+ Day::Tuesday => ::chrono::Weekday::Tue,
+ Day::Wednesday => ::chrono::Weekday::Wed,
+ Day::Thursday => ::chrono::Weekday::Thu,
+ Day::Friday => ::chrono::Weekday::Fri,
+ Day::Saturday => ::chrono::Weekday::Sat,
+ Day::Sunday => ::chrono::Weekday::Sun,
+ }
+ }
+}
+
+#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Debug)]
+pub enum Month {
+ January,
+ February,
+ March,
+ April,
+ May,
+ June,
+ July,
+ August,
+ September,
+ October,
+ November,
+ December,
+}
+
+impl Into<u32> for Month {
+ fn into(self) -> u32 {
+ match self {
+ Month::January => 1,
+ Month::February => 2,
+ Month::March => 3,
+ Month::April => 4,
+ Month::May => 5,
+ Month::June => 6,
+ Month::July => 7,
+ Month::August => 8,
+ Month::September => 9,
+ Month::October => 10,
+ Month::November => 11,
+ Month::December => 12,
+ }
+ }
+}