initial real data rendering working

This commit is contained in:
William Casarin
2022-12-11 18:56:32 -08:00
parent 98adb82e56
commit e629402d11
2 changed files with 53 additions and 24 deletions

View File

@@ -1,5 +1,6 @@
use crate::{Error, Result};
use serde_derive::{Deserialize, Serialize};
use std::hash::{Hash, Hasher};
/// Event is the struct used to represent a Nostr event
#[derive(Serialize, Deserialize, Debug, Clone)]
@@ -22,6 +23,13 @@ pub struct Event {
pub sig: String,
}
// Implement Hash trait
impl Hash for Event {
fn hash<H: Hasher>(&self, state: &mut H) {
self.id.hash(state);
}
}
impl PartialEq for Event {
fn eq(&self, other: &Self) -> bool {
self.id == other.id