Derive PartialEq where possible.

This commit is contained in:
Jimmy Cuadra 2019-06-15 00:03:32 -07:00
parent a0ee826828
commit f4b7204f31
23 changed files with 28 additions and 28 deletions

View File

@ -10,7 +10,7 @@ pub mod hangup;
pub mod invite; pub mod invite;
/// A VoIP session description. /// A VoIP session description.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct SessionDescription { pub struct SessionDescription {
/// The type of session description. /// The type of session description.
#[serde(rename = "type")] #[serde(rename = "type")]

View File

@ -10,7 +10,7 @@ room_event! {
} }
/// The payload of an `AnswerEvent`. /// The payload of an `AnswerEvent`.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct AnswerEventContent { pub struct AnswerEventContent {
/// The VoIP session description object. The session description type must be *answer*. /// The VoIP session description object. The session description type must be *answer*.
pub answer: SessionDescription, pub answer: SessionDescription,

View File

@ -10,7 +10,7 @@ room_event! {
} }
/// The payload of a `CandidatesEvent`. /// The payload of a `CandidatesEvent`.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct CandidatesEventContent { pub struct CandidatesEventContent {
/// The ID of the call this event relates to. /// The ID of the call this event relates to.
pub call_id: String, pub call_id: String,
@ -23,7 +23,7 @@ pub struct CandidatesEventContent {
} }
/// An ICE (Interactive Connectivity Establishment) candidate. /// An ICE (Interactive Connectivity Establishment) candidate.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct Candidate { pub struct Candidate {
/// The SDP "a" line of the candidate. /// The SDP "a" line of the candidate.
pub candidate: String, pub candidate: String,

View File

@ -9,7 +9,7 @@ room_event! {
} }
/// The payload of a `HangupEvent`. /// The payload of a `HangupEvent`.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct HangupEventContent { pub struct HangupEventContent {
/// The ID of the call this event relates to. /// The ID of the call this event relates to.
pub call_id: String, pub call_id: String,

View File

@ -10,7 +10,7 @@ room_event! {
} }
/// The payload of an `InviteEvent`. /// The payload of an `InviteEvent`.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct InviteEventContent { pub struct InviteEventContent {
/// A unique identifer for the call. /// A unique identifer for the call.
pub call_id: String, pub call_id: String,

View File

@ -10,7 +10,7 @@ event! {
} }
/// The payload of an *m.key.verification.key* event. /// The payload of an *m.key.verification.key* event.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct KeyEventContent { pub struct KeyEventContent {
/// An opaque identifier for the verification process. /// An opaque identifier for the verification process.
/// ///

View File

@ -134,7 +134,7 @@ pub mod tag;
pub mod typing; pub mod typing;
/// An error when attempting to convert a string to an enum that only accepts certain values. /// An error when attempting to convert a string to an enum that only accepts certain values.
#[derive(Clone, Copy, Debug)] #[derive(Clone, Copy, Eq, Debug, Hash, PartialEq)]
pub struct ParseError; pub struct ParseError;
/// The type of an event. /// The type of an event.

View File

@ -20,7 +20,7 @@ event! {
pub type ReceiptEventContent = HashMap<EventId, Receipts>; pub type ReceiptEventContent = HashMap<EventId, Receipts>;
/// A collection of receipts. /// A collection of receipts.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct Receipts { pub struct Receipts {
/// A collection of users who have sent *m.read* receipts for this event. /// A collection of users who have sent *m.read* receipts for this event.
#[serde(rename = "m.read")] #[serde(rename = "m.read")]
@ -34,7 +34,7 @@ pub struct Receipts {
pub type UserReceipts = HashMap<UserId, Receipt>; pub type UserReceipts = HashMap<UserId, Receipt>;
/// An acknowledgement of an event. /// An acknowledgement of an event.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct Receipt { pub struct Receipt {
/// The timestamp (milliseconds since the Unix epoch) when the receipt was sent. /// The timestamp (milliseconds since the Unix epoch) when the receipt was sent.
pub ts: Option<u64>, pub ts: Option<u64>,

View File

@ -9,7 +9,7 @@ state_event! {
} }
/// The payload of an `AliasesEvent`. /// The payload of an `AliasesEvent`.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct AliasesEventContent { pub struct AliasesEventContent {
/// A list of room aliases. /// A list of room aliases.
pub aliases: Vec<RoomAliasId>, pub aliases: Vec<RoomAliasId>,

View File

@ -12,7 +12,7 @@ state_event! {
} }
/// The payload of an `AvatarEvent`. /// The payload of an `AvatarEvent`.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct AvatarEventContent { pub struct AvatarEventContent {
/// Information about the avatar image. /// Information about the avatar image.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]

View File

@ -10,7 +10,7 @@ state_event! {
} }
/// The payload of a `CanonicalAliasEvent`. /// The payload of a `CanonicalAliasEvent`.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct CanonicalAliasEventContent { pub struct CanonicalAliasEventContent {
/// The canonical alias. /// The canonical alias.
/// Rooms with `alias: None` should be treated the same as a room with no canonical alias. /// Rooms with `alias: None` should be treated the same as a room with no canonical alias.

View File

@ -11,7 +11,7 @@ state_event! {
} }
/// The payload of a `GuestAccessEvent`. /// The payload of a `GuestAccessEvent`.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct GuestAccessEventContent { pub struct GuestAccessEventContent {
/// A policy for guest user access to a room. /// A policy for guest user access to a room.
pub guest_access: GuestAccess, pub guest_access: GuestAccess,

View File

@ -9,7 +9,7 @@ state_event! {
} }
/// The payload of a `HistoryVisibilityEvent`. /// The payload of a `HistoryVisibilityEvent`.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct HistoryVisibilityEventContent { pub struct HistoryVisibilityEventContent {
/// Who can see the room history. /// Who can see the room history.
pub history_visibility: HistoryVisibility, pub history_visibility: HistoryVisibility,

View File

@ -8,7 +8,7 @@ state_event! {
} }
/// The payload of a `JoinRulesEvent`. /// The payload of a `JoinRulesEvent`.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct JoinRulesEventContent { pub struct JoinRulesEventContent {
/// The type of rules used for users wishing to join this room. /// The type of rules used for users wishing to join this room.
pub join_rule: JoinRule, pub join_rule: JoinRule,

View File

@ -9,7 +9,7 @@ state_event! {
} }
/// The payload of a `NameEvent`. /// The payload of a `NameEvent`.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct NameEventContent { pub struct NameEventContent {
/// The name of the room. This MUST NOT exceed 255 bytes. /// The name of the room. This MUST NOT exceed 255 bytes.
// The spec says “A room with an m.room.name event with an absent, null, or empty name field // The spec says “A room with an m.room.name event with an absent, null, or empty name field

View File

@ -9,7 +9,7 @@ state_event! {
} }
/// The payload of a `NameEvent`. /// The payload of a `NameEvent`.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct PinnedEventsContent { pub struct PinnedEventsContent {
/// An ordered list of event IDs to pin. /// An ordered list of event IDs to pin.
pub pinned: Vec<EventId>, pub pinned: Vec<EventId>,

View File

@ -13,7 +13,7 @@ state_event! {
} }
/// The payload of a `PowerLevelsEvent`. /// The payload of a `PowerLevelsEvent`.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct PowerLevelsEventContent { pub struct PowerLevelsEventContent {
/// The level required to ban a user. /// The level required to ban a user.
#[serde(default = "default_power_level")] #[serde(default = "default_power_level")]
@ -60,7 +60,7 @@ pub struct PowerLevelsEventContent {
} }
/// The power level requirements for specific notification types. /// The power level requirements for specific notification types.
#[derive(Clone, Copy, Debug, Deserialize, Serialize)] #[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)]
pub struct NotificationPowerLevels { pub struct NotificationPowerLevels {
/// The level required to trigger an `@room` notification. /// The level required to trigger an `@room` notification.
#[serde(default = "default_power_level")] #[serde(default = "default_power_level")]

View File

@ -12,7 +12,7 @@ room_event! {
} }
/// The payload of a `RedactionEvent`. /// The payload of a `RedactionEvent`.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct RedactionEventContent { pub struct RedactionEventContent {
/// The reason for the redaction, if any. /// The reason for the redaction, if any.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]

View File

@ -12,7 +12,7 @@ state_event! {
} }
/// The payload of a `ThirdPartyInviteEvent`. /// The payload of a `ThirdPartyInviteEvent`.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct ThirdPartyInviteEventContent { pub struct ThirdPartyInviteEventContent {
/// A user-readable string which represents the user who has been invited. /// A user-readable string which represents the user who has been invited.
pub display_name: String, pub display_name: String,
@ -29,7 +29,7 @@ pub struct ThirdPartyInviteEventContent {
} }
/// A public key for signing a third party invite token. /// A public key for signing a third party invite token.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct PublicKey { pub struct PublicKey {
/// An optional URL which can be fetched to validate whether the key has been revoked. /// An optional URL which can be fetched to validate whether the key has been revoked.
/// ///

View File

@ -8,7 +8,7 @@ state_event! {
} }
/// The payload of a `TopicEvent`. /// The payload of a `TopicEvent`.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct TopicEventContent { pub struct TopicEventContent {
/// The topic text. /// The topic text.
pub topic: String, pub topic: String,

View File

@ -63,7 +63,7 @@ pub enum StrippedState {
} }
/// A "stripped-down" version of a core state event. /// A "stripped-down" version of a core state event.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct StrippedStateContent<C> { pub struct StrippedStateContent<C> {
/// Data specific to the event type. /// Data specific to the event type.
pub content: C, pub content: C,

View File

@ -10,14 +10,14 @@ event! {
} }
/// The payload of a `TagEvent`. /// The payload of a `TagEvent`.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct TagEventContent { pub struct TagEventContent {
/// A map of tag names to tag info. /// A map of tag names to tag info.
pub tags: HashMap<String, TagInfo>, pub tags: HashMap<String, TagInfo>,
} }
/// Information about a tag. /// Information about a tag.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct TagInfo { pub struct TagInfo {
/// Value to use for lexicographically ordering rooms with this tag. /// Value to use for lexicographically ordering rooms with this tag.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]

View File

@ -12,7 +12,7 @@ event! {
} }
/// The payload of a `TypingEvent`. /// The payload of a `TypingEvent`.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct TypingEventContent { pub struct TypingEventContent {
/// The list of user IDs typing in this room, if any. /// The list of user IDs typing in this room, if any.
pub user_ids: Vec<UserId>, pub user_ids: Vec<UserId>,