diff options
author | Ruben Pollan | 2018-11-26 13:10:38 -0600 |
---|---|---|
committer | Ruben Pollan | 2018-11-26 13:10:38 -0600 |
commit | 3cb2a06d610d4e8121449ab09210c0f9a7414860 (patch) | |
tree | 4a25fcf3f5679858dece9d7c03016da86cbc69b4 /src | |
parent | e11ee60b2619a0137e24420a5de98112ecfd4ba7 (diff) |
Convert the project into a lib + main
Diffstat (limited to 'src')
-rw-r--r-- | src/lib.rs | 13 | ||||
-rw-r--r-- | src/main.rs | 20 |
2 files changed, 18 insertions, 15 deletions
diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..85ba6c0 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,13 @@ +extern crate ical; +extern crate chrono; +extern crate chrono_tz; + +mod date; +mod event; +mod periodic; +mod calendar; +mod errors; + +pub use calendar::Calendar; +pub use date::Date; +pub use chrono::Duration; diff --git a/src/main.rs b/src/main.rs index 67eb0fc..6d9544b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,30 +1,20 @@ -extern crate ical; -extern crate chrono; -extern crate chrono_tz; - -mod date; -mod event; -mod periodic; -mod calendar; -mod errors; +extern crate almanac; use std::env; use std::io::BufReader; use std::fs::File; -use chrono::Duration; -use date::Date; -use calendar::Calendar; +use almanac::Duration; +use almanac::Date; +use almanac::Calendar; fn main() { let args: Vec<_> = env::args().collect(); let file = File::open(&args[1]).unwrap(); let buf = BufReader::new(file); let calendar = Calendar::parse(buf).unwrap(); - println!("{}", calendar); - println!(""); let now = Date::now(); - let events = calendar.get(&now, &(now + Duration::weeks(10))); + let events = calendar.get(&now, &(now + Duration::days(1))); for e in events { println!("{}", e); } |