mirror of
https://github.com/mikedilger/chorus.git
synced 2026-03-04 06:36:27 +00:00
impl Ord for Event
This commit is contained in:
parent
3a6f89649e
commit
8828074e7c
@ -1,6 +1,7 @@
|
||||
use super::{Id, Kind, Pubkey, Sig, Tags, Time};
|
||||
use crate::error::{ChorusError, Error};
|
||||
use crate::types::parse::json_escape::json_escape;
|
||||
use std::cmp::Ordering;
|
||||
use std::fmt;
|
||||
|
||||
mod json_event;
|
||||
@ -178,6 +179,20 @@ impl fmt::Display for Event<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
impl Eq for Event<'_> {}
|
||||
|
||||
impl PartialOrd for Event<'_> {
|
||||
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
|
||||
Some(self.cmp(other))
|
||||
}
|
||||
}
|
||||
|
||||
impl Ord for Event<'_> {
|
||||
fn cmp(&self, other: &Self) -> Ordering {
|
||||
self.created_at().cmp(&other.created_at())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct OwnedEvent(pub Vec<u8>);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user