From 3cb2a06d610d4e8121449ab09210c0f9a7414860 Mon Sep 17 00:00:00 2001 From: Ruben Pollan Date: Mon, 26 Nov 2018 13:10:38 -0600 Subject: Convert the project into a lib + main --- src/lib.rs | 13 +++++++++++++ src/main.rs | 20 +++++--------------- 2 files changed, 18 insertions(+), 15 deletions(-) create mode 100644 src/lib.rs 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); } -- cgit v1.2.3