aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAkshay <[email protected]>2020-02-10 17:14:45 +0000
committerAkshay <[email protected]>2020-02-10 17:14:45 +0000
commit5019b6f52e0ff6649d318d8e600e1cd52fb01c7f (patch)
tree74a791d7ed6d84b28aaaaf9e01cf6924de5952f4 /src
parent10e2c495f0b9f1570ad94cf7caf3deaab510fcd2 (diff)
new module structure
Diffstat (limited to 'src')
-rw-r--r--src/main.rs14
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;
9use crate::habit::Habit; 9use crate::habit::Habit;
10 10
11mod views; 11mod views;
12use crate::views::BitView; 12use crate::views::bitview::BitView;
13use crate::views::countview::CountView;
13 14
14mod theme; 15mod theme;
15 16
@@ -19,7 +20,7 @@ enum ViewMode {
19} 20}
20 21
21fn main() { 22fn 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());