Skip to content

Commit

Permalink
nostr: impl Hash for TagIndexes
Browse files Browse the repository at this point in the history
  • Loading branch information
yukibtc committed Jan 8, 2024
1 parent f4c5583 commit 5616542
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions crates/nostr-database/src/tag_indexes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,18 @@ use nostr::{Alphabet, GenericTagValue};
pub const TAG_INDEX_VALUE_SIZE: usize = 8;

/// Tag Indexes
#[derive(Debug, Clone, Default, PartialEq, Eq)]
#[derive(Debug, Clone, Default, PartialEq, Eq, Hash)]
pub struct TagIndexes {
inner: HashMap<Alphabet, TagIndexValues>,
}

impl TagIndexes {
#[allow(missing_docs)]
pub fn new(map: BTreeMap<Alphabet, TagIndexValues>) -> Self {
Self { inner: map }
}
}

impl Deref for TagIndexes {
type Target = HashMap<Alphabet, TagIndexValues>;
fn deref(&self) -> &Self::Target {
Expand Down Expand Up @@ -70,7 +77,7 @@ where
}

/// Tag Index Values
#[derive(Debug, Clone, Default, PartialEq, Eq)]
#[derive(Debug, Clone, Default, PartialEq, Eq, Hash)]
pub struct TagIndexValues {
inner: HashSet<[u8; TAG_INDEX_VALUE_SIZE]>,
}
Expand Down

0 comments on commit 5616542

Please sign in to comment.