Browse Source

Remove path modules

master
Julio Biason 4 years ago
parent
commit
b397033a09
  1. 4
      src/event.rs
  2. 4
      src/eventlist.rs
  3. 53
      src/eventlist/event/date.rs
  4. 47
      src/eventlist/event/time.rs
  5. 20
      src/eventlist/mod.rs
  6. 0
      src/eventtype.rs
  7. 6
      src/main.rs

4
src/eventlist/event/mod.rs → 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 {

4
src/eventlist/eventlist.rs → 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";

53
src/eventlist/event/date.rs

@ -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 <https://www.gnu.org/licenses/>.
*/
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<Local>> for Date {
fn from(origin: &DateTime<Local>) -> 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
}
}

47
src/eventlist/event/time.rs

@ -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 <https://www.gnu.org/licenses/>.
*/
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<Local>> for Time {
fn from(origin: &DateTime<Local>) -> Time {
Time {
hour: origin.hour(),
min: origin.minute(),
}
}
}
impl Time {
pub fn hour(&self) -> u32 {
self.hour
}
pub fn minute(&self) -> u32 {
self.min
}
}

20
src/eventlist/mod.rs

@ -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 <https://www.gnu.org/licenses/>.
*/
pub mod event;
pub mod eventlist;

0
src/eventlist/event/eventtype.rs → src/eventtype.rs

6
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();

Loading…
Cancel
Save