From ef81d87d9444e51ddf0aa7380e168dda793361b9 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 28 May 2016 17:53:20 +0200 Subject: [PATCH] Add Time type --- libimagtimeui/src/lib.rs | 1 + libimagtimeui/src/time.rs | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 libimagtimeui/src/time.rs diff --git a/libimagtimeui/src/lib.rs b/libimagtimeui/src/lib.rs index 2ec7af12..2d527f50 100644 --- a/libimagtimeui/src/lib.rs +++ b/libimagtimeui/src/lib.rs @@ -6,4 +6,5 @@ extern crate regex; #[macro_use] extern crate libimagerror; pub mod date; +pub mod time; diff --git a/libimagtimeui/src/time.rs b/libimagtimeui/src/time.rs new file mode 100644 index 00000000..7da49971 --- /dev/null +++ b/libimagtimeui/src/time.rs @@ -0,0 +1,34 @@ +use chrono::naive::time::NaiveTime as ChronoNaiveTime; + +use parse::Parse; + +pub struct Time { + hour: u32, + minute: u32, + second: u32, +} + +impl Time { + + fn new(hour: u32, minute: u32, second: u32) -> Time { + unimplemented!() + } + +} + +impl Into for Time { + + fn into(self) -> ChronoNaiveTime { + ChronoNaiveTime::from_hms(self.hour, self.minute, self.second) + } + +} + +impl Parse for Time { + + fn parse(s: &str) -> Option