diff options
author | Akshay <[email protected]> | 2020-02-10 17:14:45 +0000 |
---|---|---|
committer | Akshay <[email protected]> | 2020-02-10 17:14:45 +0000 |
commit | 5019b6f52e0ff6649d318d8e600e1cd52fb01c7f (patch) | |
tree | 74a791d7ed6d84b28aaaaf9e01cf6924de5952f4 /src/main.rs | |
parent | 10e2c495f0b9f1570ad94cf7caf3deaab510fcd2 (diff) |
new module structure
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/main.rs b/src/main.rs index a3bbed6..128df03 100644 --- a/src/main.rs +++ b/src/main.rs | |||
@@ -9,7 +9,8 @@ mod habit; | |||
9 | use crate::habit::Habit; | 9 | use crate::habit::Habit; |
10 | 10 | ||
11 | mod views; | 11 | mod views; |
12 | use crate::views::BitView; | 12 | use crate::views::bitview::BitView; |
13 | use crate::views::countview::CountView; | ||
13 | 14 | ||
14 | mod theme; | 15 | mod theme; |
15 | 16 | ||
@@ -19,7 +20,7 @@ enum ViewMode { | |||
19 | } | 20 | } |
20 | 21 | ||
21 | fn main() { | 22 | fn main() { |
22 | let mut work_out: Habit<bool> = Habit::new("gymming"); | 23 | let mut work_out: Habit<bool> = Habit::new("gymming", true); |
23 | work_out.insert_entry(NaiveDate::from_ymd(2020, 2, 4), true); | 24 | work_out.insert_entry(NaiveDate::from_ymd(2020, 2, 4), true); |
24 | work_out.insert_entry(NaiveDate::from_ymd(2020, 2, 2), true); | 25 | work_out.insert_entry(NaiveDate::from_ymd(2020, 2, 2), true); |
25 | work_out.insert_entry(NaiveDate::from_ymd(2020, 2, 3), true); | 26 | work_out.insert_entry(NaiveDate::from_ymd(2020, 2, 3), true); |
@@ -28,16 +29,17 @@ fn main() { | |||
28 | work_out.insert_entry(NaiveDate::from_ymd(2020, 2, 8), false); | 29 | work_out.insert_entry(NaiveDate::from_ymd(2020, 2, 8), false); |
29 | work_out.insert_entry(NaiveDate::from_ymd(2020, 2, 11), false); | 30 | work_out.insert_entry(NaiveDate::from_ymd(2020, 2, 11), false); |
30 | 31 | ||
31 | let mut again: Habit<bool> = Habit::new("reading"); | 32 | let mut again: Habit<u32> = Habit::new("reading", 5); |
32 | again.insert_entry(NaiveDate::from_ymd(2020, 2, 4), true); | 33 | again.insert_entry(NaiveDate::from_ymd(2020, 2, 4), 4); |
33 | again.insert_entry(NaiveDate::from_ymd(2020, 2, 2), true); | 34 | again.insert_entry(NaiveDate::from_ymd(2020, 2, 2), 2); |
35 | again.insert_entry(NaiveDate::from_ymd(2020, 2, 7), 5); | ||
34 | 36 | ||
35 | let mut s = Cursive::default(); | 37 | let mut s = Cursive::default(); |
36 | 38 | ||
37 | let gym_view = BitView::new(work_out); | 39 | let gym_view = BitView::new(work_out); |
38 | let gym_title = gym_view.get_title(); | 40 | let gym_title = gym_view.get_title(); |
39 | 41 | ||
40 | let reading_view = BitView::new(again); | 42 | let reading_view = CountView::new(again); |
41 | let reading_title = reading_view.get_title(); | 43 | let reading_title = reading_view.get_title(); |
42 | 44 | ||
43 | s.add_global_callback('q', |a| a.quit()); | 45 | s.add_global_callback('q', |a| a.quit()); |