diff --git a/chorus-lib/src/types/event/mod.rs b/chorus-lib/src/types/event/mod.rs index fe5f63d..1215282 100644 --- a/chorus-lib/src/types/event/mod.rs +++ b/chorus-lib/src/types/event/mod.rs @@ -205,7 +205,9 @@ impl PartialOrd for Event<'_> { impl Ord for Event<'_> { fn cmp(&self, other: &Self) -> Ordering { - self.created_at().cmp(&other.created_at()) + self.created_at() + .cmp(&other.created_at()) + .then(self.id().cmp(&other.id())) } } diff --git a/chorus-lib/src/types/id.rs b/chorus-lib/src/types/id.rs index 6027e11..a922eab 100644 --- a/chorus-lib/src/types/id.rs +++ b/chorus-lib/src/types/id.rs @@ -2,7 +2,7 @@ use crate::error::Error; use serde::{Deserialize, Serialize}; use std::fmt; -#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct Id(pub [u8; 32]); impl Id {