Derive PartialEq where possible.
This commit is contained in:
parent
a0ee826828
commit
f4b7204f31
@ -10,7 +10,7 @@ pub mod hangup;
|
||||
pub mod invite;
|
||||
|
||||
/// A VoIP session description.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct SessionDescription {
|
||||
/// The type of session description.
|
||||
#[serde(rename = "type")]
|
||||
|
@ -10,7 +10,7 @@ room_event! {
|
||||
}
|
||||
|
||||
/// The payload of an `AnswerEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct AnswerEventContent {
|
||||
/// The VoIP session description object. The session description type must be *answer*.
|
||||
pub answer: SessionDescription,
|
||||
|
@ -10,7 +10,7 @@ room_event! {
|
||||
}
|
||||
|
||||
/// The payload of a `CandidatesEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct CandidatesEventContent {
|
||||
/// The ID of the call this event relates to.
|
||||
pub call_id: String,
|
||||
@ -23,7 +23,7 @@ pub struct CandidatesEventContent {
|
||||
}
|
||||
|
||||
/// An ICE (Interactive Connectivity Establishment) candidate.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct Candidate {
|
||||
/// The SDP "a" line of the candidate.
|
||||
pub candidate: String,
|
||||
|
@ -9,7 +9,7 @@ room_event! {
|
||||
}
|
||||
|
||||
/// The payload of a `HangupEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct HangupEventContent {
|
||||
/// The ID of the call this event relates to.
|
||||
pub call_id: String,
|
||||
|
@ -10,7 +10,7 @@ room_event! {
|
||||
}
|
||||
|
||||
/// The payload of an `InviteEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct InviteEventContent {
|
||||
/// A unique identifer for the call.
|
||||
pub call_id: String,
|
||||
|
@ -10,7 +10,7 @@ event! {
|
||||
}
|
||||
|
||||
/// The payload of an *m.key.verification.key* event.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct KeyEventContent {
|
||||
/// An opaque identifier for the verification process.
|
||||
///
|
||||
|
@ -134,7 +134,7 @@ pub mod tag;
|
||||
pub mod typing;
|
||||
|
||||
/// 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;
|
||||
|
||||
/// The type of an event.
|
||||
|
@ -20,7 +20,7 @@ event! {
|
||||
pub type ReceiptEventContent = HashMap<EventId, Receipts>;
|
||||
|
||||
/// A collection of receipts.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct Receipts {
|
||||
/// A collection of users who have sent *m.read* receipts for this event.
|
||||
#[serde(rename = "m.read")]
|
||||
@ -34,7 +34,7 @@ pub struct Receipts {
|
||||
pub type UserReceipts = HashMap<UserId, Receipt>;
|
||||
|
||||
/// An acknowledgement of an event.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct Receipt {
|
||||
/// The timestamp (milliseconds since the Unix epoch) when the receipt was sent.
|
||||
pub ts: Option<u64>,
|
||||
|
@ -9,7 +9,7 @@ state_event! {
|
||||
}
|
||||
|
||||
/// The payload of an `AliasesEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct AliasesEventContent {
|
||||
/// A list of room aliases.
|
||||
pub aliases: Vec<RoomAliasId>,
|
||||
|
@ -12,7 +12,7 @@ state_event! {
|
||||
}
|
||||
|
||||
/// The payload of an `AvatarEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct AvatarEventContent {
|
||||
/// Information about the avatar image.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
|
@ -10,7 +10,7 @@ state_event! {
|
||||
}
|
||||
|
||||
/// The payload of a `CanonicalAliasEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct CanonicalAliasEventContent {
|
||||
/// The canonical alias.
|
||||
/// Rooms with `alias: None` should be treated the same as a room with no canonical alias.
|
||||
|
@ -11,7 +11,7 @@ state_event! {
|
||||
}
|
||||
|
||||
/// The payload of a `GuestAccessEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct GuestAccessEventContent {
|
||||
/// A policy for guest user access to a room.
|
||||
pub guest_access: GuestAccess,
|
||||
|
@ -9,7 +9,7 @@ state_event! {
|
||||
}
|
||||
|
||||
/// The payload of a `HistoryVisibilityEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct HistoryVisibilityEventContent {
|
||||
/// Who can see the room history.
|
||||
pub history_visibility: HistoryVisibility,
|
||||
|
@ -8,7 +8,7 @@ state_event! {
|
||||
}
|
||||
|
||||
/// The payload of a `JoinRulesEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct JoinRulesEventContent {
|
||||
/// The type of rules used for users wishing to join this room.
|
||||
pub join_rule: JoinRule,
|
||||
|
@ -9,7 +9,7 @@ state_event! {
|
||||
}
|
||||
|
||||
/// The payload of a `NameEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct NameEventContent {
|
||||
/// 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
|
||||
|
@ -9,7 +9,7 @@ state_event! {
|
||||
}
|
||||
|
||||
/// The payload of a `NameEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct PinnedEventsContent {
|
||||
/// An ordered list of event IDs to pin.
|
||||
pub pinned: Vec<EventId>,
|
||||
|
@ -13,7 +13,7 @@ state_event! {
|
||||
}
|
||||
|
||||
/// The payload of a `PowerLevelsEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct PowerLevelsEventContent {
|
||||
/// The level required to ban a user.
|
||||
#[serde(default = "default_power_level")]
|
||||
@ -60,7 +60,7 @@ pub struct PowerLevelsEventContent {
|
||||
}
|
||||
|
||||
/// The power level requirements for specific notification types.
|
||||
#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
|
||||
#[derive(Clone, Copy, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct NotificationPowerLevels {
|
||||
/// The level required to trigger an `@room` notification.
|
||||
#[serde(default = "default_power_level")]
|
||||
|
@ -12,7 +12,7 @@ room_event! {
|
||||
}
|
||||
|
||||
/// The payload of a `RedactionEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct RedactionEventContent {
|
||||
/// The reason for the redaction, if any.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
|
@ -12,7 +12,7 @@ state_event! {
|
||||
}
|
||||
|
||||
/// The payload of a `ThirdPartyInviteEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct ThirdPartyInviteEventContent {
|
||||
/// A user-readable string which represents the user who has been invited.
|
||||
pub display_name: String,
|
||||
@ -29,7 +29,7 @@ pub struct ThirdPartyInviteEventContent {
|
||||
}
|
||||
|
||||
/// A public key for signing a third party invite token.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct PublicKey {
|
||||
/// An optional URL which can be fetched to validate whether the key has been revoked.
|
||||
///
|
||||
|
@ -8,7 +8,7 @@ state_event! {
|
||||
}
|
||||
|
||||
/// The payload of a `TopicEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct TopicEventContent {
|
||||
/// The topic text.
|
||||
pub topic: String,
|
||||
|
@ -63,7 +63,7 @@ pub enum StrippedState {
|
||||
}
|
||||
|
||||
/// A "stripped-down" version of a core state event.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct StrippedStateContent<C> {
|
||||
/// Data specific to the event type.
|
||||
pub content: C,
|
||||
|
@ -10,14 +10,14 @@ event! {
|
||||
}
|
||||
|
||||
/// The payload of a `TagEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct TagEventContent {
|
||||
/// A map of tag names to tag info.
|
||||
pub tags: HashMap<String, TagInfo>,
|
||||
}
|
||||
|
||||
/// Information about a tag.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct TagInfo {
|
||||
/// Value to use for lexicographically ordering rooms with this tag.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
|
@ -12,7 +12,7 @@ event! {
|
||||
}
|
||||
|
||||
/// The payload of a `TypingEvent`.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
|
||||
pub struct TypingEventContent {
|
||||
/// The list of user IDs typing in this room, if any.
|
||||
pub user_ids: Vec<UserId>,
|
||||
|
Loading…
x
Reference in New Issue
Block a user