aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/calendar.rs2
-rw-r--r--src/date.rs8
-rw-r--r--src/event.rs8
3 files changed, 15 insertions, 3 deletions
diff --git a/src/calendar.rs b/src/calendar.rs
index fcec54e..a46795b 100644
--- a/src/calendar.rs
+++ b/src/calendar.rs
@@ -58,7 +58,7 @@ impl Calendar {
}
}
- single.sort_by_key(|k| k.start);
+ single.sort();
Ok(Calendar { single, periodic })
}
diff --git a/src/date.rs b/src/date.rs
index 8d41c67..45a0c28 100644
--- a/src/date.rs
+++ b/src/date.rs
@@ -9,7 +9,7 @@ use chrono::offset::Utc;
use chrono_tz::{Tz, UTC};
-#[derive(Debug, Copy, Clone, PartialEq, PartialOrd, Eq)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum Date {
Time(chrono::DateTime<Tz>),
AllDay(chrono::Date<Tz>),
@@ -109,6 +109,12 @@ impl Ord for Date {
}
}
+impl PartialOrd for Date {
+ fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
+ Some(self.cmp(other))
+ }
+}
+
impl Add<Duration> for Date {
type Output = Date;
diff --git a/src/event.rs b/src/event.rs
index e186cfd..2859ff8 100644
--- a/src/event.rs
+++ b/src/event.rs
@@ -8,7 +8,7 @@ use date::Date;
use errors::EventError;
-#[derive(Debug, Clone, PartialEq, PartialOrd, Eq)]
+#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Event {
pub start: Date,
pub end: End,
@@ -82,6 +82,12 @@ impl Ord for Event {
}
}
+impl PartialOrd for Event {
+ fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
+ Some(self.cmp(other))
+ }
+}
+
impl FromStr for Status {
type Err = EventError;