aboutsummaryrefslogtreecommitdiff
path: root/src/habit/prelude.rs
blob: 8335d6cad2ef1721b227a4d61f24fbe196473369 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use serde::{Deserialize, Serialize};
use std::default;
use std::fmt;

#[derive(Debug, PartialEq)]
pub enum TrackEvent {
    Increment,
    Decrement,
}

#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
pub enum ViewMode {
    Day,
    Week,
    Month,
    Year,
}

impl default::Default for ViewMode {
    fn default() -> Self {
        ViewMode::Day
    }
}

impl fmt::Display for ViewMode {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            ViewMode::Day => write!(f, "DAY"),
            ViewMode::Week => write!(f, "WEEK"),
            ViewMode::Month => write!(f, "MONTH"),
            ViewMode::Year => write!(f, "YEAR"),
        }
    }
}

pub fn default_auto() -> bool {
    false
}