From b397033a09e21eafbe6b7266696928e3d3527afc Mon Sep 17 00:00:00 2001 From: Julio Biason Date: Mon, 22 Jun 2020 19:43:09 -0300 Subject: [PATCH] Remove path modules --- src/{eventlist/event/mod.rs => event.rs} | 4 +- src/{eventlist => }/eventlist.rs | 4 +- src/eventlist/event/date.rs | 53 ------------------------ src/eventlist/event/time.rs | 47 --------------------- src/eventlist/mod.rs | 20 --------- src/{eventlist/event => }/eventtype.rs | 0 src/main.rs | 6 ++- 7 files changed, 7 insertions(+), 127 deletions(-) rename src/{eventlist/event/mod.rs => event.rs} (97%) rename src/{eventlist => }/eventlist.rs (98%) delete mode 100644 src/eventlist/event/date.rs delete mode 100644 src/eventlist/event/time.rs delete mode 100644 src/eventlist/mod.rs rename src/{eventlist/event => }/eventtype.rs (100%) diff --git a/src/eventlist/event/mod.rs b/src/event.rs similarity index 97% rename from src/eventlist/event/mod.rs rename to src/event.rs index b416f2b..06f472c 100644 --- a/src/eventlist/event/mod.rs +++ b/src/event.rs @@ -24,9 +24,7 @@ use uuid::Uuid; use crate::date::Date; use crate::datetime::DateTime; -pub mod eventtype; - -use eventtype::EventType; +use crate::eventtype::EventType; #[derive(Serialize, Deserialize, Debug)] pub struct Event { diff --git a/src/eventlist/eventlist.rs b/src/eventlist.rs similarity index 98% rename from src/eventlist/eventlist.rs rename to src/eventlist.rs index 8644755..80bab1a 100644 --- a/src/eventlist/eventlist.rs +++ b/src/eventlist.rs @@ -25,8 +25,8 @@ use toml; use crate::date::Date; use crate::datetime::DateTime; -use crate::eventlist::event::Event; -use crate::eventlist::event::EventError; +use crate::event::Event; +use crate::event::EventError; static FILENAME: &str = "events.toml"; diff --git a/src/eventlist/event/date.rs b/src/eventlist/event/date.rs deleted file mode 100644 index 6ccd462..0000000 --- a/src/eventlist/event/date.rs +++ /dev/null @@ -1,53 +0,0 @@ -/* - TU - Time's Up! - Copyright (C) 2020 Julio Biason - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ - -use chrono::prelude::*; -use chrono::DateTime; -use serde_derive::Deserialize; -use serde_derive::Serialize; - -#[derive(Serialize, Deserialize, Debug)] -pub struct Date { - year: i32, - month: u32, - day: u32, -} - -impl From<&DateTime> for Date { - fn from(origin: &DateTime) -> Date { - Date { - year: origin.year(), - month: origin.month(), - day: origin.day(), - } - } -} - -impl Date { - pub fn year(&self) -> i32 { - self.year - } - - pub fn month(&self) -> u32 { - self.month - } - - pub fn day(&self) -> u32 { - self.day - } -} diff --git a/src/eventlist/event/time.rs b/src/eventlist/event/time.rs deleted file mode 100644 index ce9a0a5..0000000 --- a/src/eventlist/event/time.rs +++ /dev/null @@ -1,47 +0,0 @@ -/* - TU - Time's Up! - Copyright (C) 2020 Julio Biason - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ - -use chrono::prelude::*; -use chrono::DateTime; -use serde_derive::Deserialize; -use serde_derive::Serialize; - -#[derive(Serialize, Deserialize, Debug)] -pub struct Time { - hour: u32, - min: u32, -} - -impl From<&DateTime> for Time { - fn from(origin: &DateTime) -> Time { - Time { - hour: origin.hour(), - min: origin.minute(), - } - } -} - -impl Time { - pub fn hour(&self) -> u32 { - self.hour - } - - pub fn minute(&self) -> u32 { - self.min - } -} diff --git a/src/eventlist/mod.rs b/src/eventlist/mod.rs deleted file mode 100644 index 86656e3..0000000 --- a/src/eventlist/mod.rs +++ /dev/null @@ -1,20 +0,0 @@ -/* - TU - Time's Up! - Copyright (C) 2020 Julio Biason - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ - -pub mod event; -pub mod eventlist; diff --git a/src/eventlist/event/eventtype.rs b/src/eventtype.rs similarity index 100% rename from src/eventlist/event/eventtype.rs rename to src/eventtype.rs diff --git a/src/main.rs b/src/main.rs index 20ff88c..96a02d6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -22,10 +22,12 @@ mod args; mod date; mod date_errors; mod datetime; +mod event; mod eventlist; +mod eventtype; -use crate::eventlist::event::eventtype::EventType; -use crate::eventlist::eventlist::EventList; +use eventlist::EventList; +use eventtype::EventType; fn main() { env_logger::init();