aboutsummaryrefslogtreecommitdiff
path: root/src/habit
diff options
context:
space:
mode:
Diffstat (limited to 'src/habit')
-rw-r--r--src/habit/prelude.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/habit/prelude.rs b/src/habit/prelude.rs
index b8b2bb2..19b00a7 100644
--- a/src/habit/prelude.rs
+++ b/src/habit/prelude.rs
@@ -1,4 +1,6 @@
1use serde::{Deserialize, Serialize}; 1use serde::{Deserialize, Serialize};
2use std::default;
3use std::fmt;
2 4
3pub enum TrackEvent { 5pub enum TrackEvent {
4 Increment, 6 Increment,
@@ -13,12 +15,23 @@ pub enum ViewMode {
13 Year, 15 Year,
14} 16}
15 17
16impl std::default::Default for ViewMode { 18impl default::Default for ViewMode {
17 fn default() -> Self { 19 fn default() -> Self {
18 ViewMode::Day 20 ViewMode::Day
19 } 21 }
20} 22}
21 23
24impl fmt::Display for ViewMode {
25 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
26 match self {
27 ViewMode::Day => write!(f, "DAY"),
28 ViewMode::Week => write!(f, "WEEK"),
29 ViewMode::Month => write!(f, "MONTH"),
30 ViewMode::Year => write!(f, "YEAR"),
31 }
32 }
33}
34
22pub fn default_auto() -> bool { 35pub fn default_auto() -> bool {
23 false 36 false
24} 37}