Skip to content

Commit 54bdb99

Browse files
committed
mls-storage: derive PartialEq, Eq, PartialOrd, Ord, and Hash where missing
Derive `PartialEq`, `Eq`, `PartialOrd`, `Ord`, and `Hash` traits for `Group`, `ProcessedMessage`, `Message`, `ProcessedWelcome` and `Welcome`. Signed-off-by: Yuki Kishimoto <[email protected]>
1 parent 9c08c11 commit 54bdb99

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

crates/nostr-mls-storage/src/groups/types.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ impl<'de> Deserialize<'de> for GroupState {
129129
/// A Nostr MLS group
130130
///
131131
/// Stores metadata about the group
132-
#[derive(Debug, Clone, Serialize, Deserialize)]
132+
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
133133
pub struct Group {
134134
/// This is the MLS group ID, this will serve as the PK in the DB and doesn't change
135135
pub mls_group_id: Vec<u8>,
@@ -156,7 +156,7 @@ pub struct Group {
156156
/// A Nostr MLS group relay
157157
///
158158
/// Stores a relay URL and the MLS group ID it belongs to
159-
#[derive(Debug, Clone, Serialize, Deserialize)]
159+
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
160160
pub struct GroupRelay {
161161
/// The relay URL
162162
pub relay_url: RelayUrl,

crates/nostr-mls-storage/src/messages/types.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer};
1010
use super::error::MessageError;
1111

1212
/// A processed message, this stores data about whether we have processed a message or not
13-
#[derive(Debug, Clone, Serialize, Deserialize)]
13+
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
1414
pub struct ProcessedMessage {
1515
/// The event id of the processed message
1616
pub wrapper_event_id: EventId,
@@ -26,7 +26,7 @@ pub struct ProcessedMessage {
2626

2727
/// This is the processed rumor message that represents a message in a group
2828
/// We store the deconstructed messages but also the UnsignedEvent.
29-
#[derive(Debug, Clone, Serialize, Deserialize)]
29+
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
3030
pub struct Message {
3131
/// The event id of the message
3232
pub id: EventId,

crates/nostr-mls-storage/src/welcomes/types.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer};
99
use super::error::WelcomeError;
1010

1111
/// A processed welcome, this stores data about whether we have processed a welcome or not
12-
#[derive(Debug, Clone, Serialize, Deserialize)]
12+
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
1313
pub struct ProcessedWelcome {
1414
/// The event id of the processed welcome
1515
pub wrapper_event_id: EventId,
@@ -24,7 +24,7 @@ pub struct ProcessedWelcome {
2424
}
2525

2626
/// A welcome message
27-
#[derive(Debug, Clone, Serialize, Deserialize)]
27+
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
2828
pub struct Welcome {
2929
/// The event id of the kind 444 welcome
3030
pub id: EventId,

0 commit comments

Comments
 (0)