diff --git a/src/entities/account.rs b/src/entities/account.rs index 0027d5b..5ba4c27 100644 --- a/src/entities/account.rs +++ b/src/entities/account.rs @@ -6,7 +6,7 @@ use status_builder; use std::path::PathBuf; /// A struct representing an Account. -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, PartialEq)] pub struct Account { /// Equals `username` for local users, includes `@domain` for remote ones. pub acct: String, @@ -68,7 +68,7 @@ impl MetadataField { } /// An extra object given from `verify_credentials` giving defaults about a user -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, PartialEq)] pub struct Source { privacy: status_builder::Visibility, #[serde(deserialize_with = "string_or_bool")] @@ -78,7 +78,7 @@ pub struct Source { } fn string_or_bool<'de, D: Deserializer<'de>>(val: D) -> ::std::result::Result { - #[derive(Clone, Debug, Deserialize)] + #[derive(Clone, Debug, Deserialize, PartialEq)] #[serde(untagged)] pub enum BoolOrString { Bool(bool), diff --git a/src/entities/attachment.rs b/src/entities/attachment.rs index e91e24e..740db19 100644 --- a/src/entities/attachment.rs +++ b/src/entities/attachment.rs @@ -1,7 +1,7 @@ //! Module containing everything related to media attachements. /// A struct representing a media attachment. -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, PartialEq)] pub struct Attachment { /// ID of the attachment. pub id: String, @@ -24,7 +24,7 @@ pub struct Attachment { } /// Information about the attachment itself. -#[derive(Debug, Deserialize, Clone)] +#[derive(Debug, Deserialize, Clone, PartialEq)] pub struct Meta { /// Original version. pub original: Option, @@ -33,7 +33,7 @@ pub struct Meta { } /// Dimensions of an attachement. -#[derive(Debug, Deserialize, Clone)] +#[derive(Debug, Deserialize, Clone, PartialEq)] pub struct ImageDetails { /// width of attachment. width: u64, @@ -46,7 +46,7 @@ pub struct ImageDetails { } /// The type of media attachment. -#[derive(Debug, Deserialize, Clone, Copy)] +#[derive(Debug, Deserialize, Clone, Copy, PartialEq)] pub enum MediaType { /// An image. #[serde(rename = "image")] diff --git a/src/entities/card.rs b/src/entities/card.rs index 475d0e5..9849964 100644 --- a/src/entities/card.rs +++ b/src/entities/card.rs @@ -1,7 +1,7 @@ //! Module representing cards of statuses. /// A card of a status. -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, PartialEq)] pub struct Card { /// The url associated with the card. pub url: String, diff --git a/src/entities/context.rs b/src/entities/context.rs index d79e3f7..60a4ea2 100644 --- a/src/entities/context.rs +++ b/src/entities/context.rs @@ -4,7 +4,7 @@ use super::status::Status; /// A context of a status returning a list of statuses it replied to and /// statuses replied to it. -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, PartialEq)] pub struct Context { /// Statuses that were replied to. pub ancestors: Vec, diff --git a/src/entities/instance.rs b/src/entities/instance.rs index 0b1ce00..66d60ca 100644 --- a/src/entities/instance.rs +++ b/src/entities/instance.rs @@ -2,7 +2,7 @@ use super::account::Account; /// A struct containing info of an instance. -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, PartialEq)] pub struct Instance { /// URI of the current instance pub uri: String, @@ -30,14 +30,14 @@ pub struct Instance { } /// Object containing url for streaming api. -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, PartialEq)] pub struct StreamingApi { /// Url for streaming API, typically a `wss://` url. pub streaming_api: String, } /// Statistics about the Mastodon instance. -#[derive(Debug, Clone, Copy, Deserialize)] +#[derive(Debug, Clone, Copy, Deserialize, PartialEq)] pub struct Stats { user_count: u64, status_count: u64, diff --git a/src/entities/list.rs b/src/entities/list.rs index e4c5698..8d640c8 100644 --- a/src/entities/list.rs +++ b/src/entities/list.rs @@ -1,5 +1,5 @@ /// Used for ser/de of list resources -#[derive(Clone, Debug, Deserialize)] +#[derive(Clone, Debug, Deserialize, PartialEq)] pub struct List { id: String, title: String, diff --git a/src/entities/mention.rs b/src/entities/mention.rs index 517fda5..8c5a392 100644 --- a/src/entities/mention.rs +++ b/src/entities/mention.rs @@ -1,5 +1,5 @@ /// Represents a `mention` used in a status -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq)] pub struct Mention { /// URL of user's profile (can be remote) pub url: String, diff --git a/src/entities/notification.rs b/src/entities/notification.rs index 8f7759b..6ad4c37 100644 --- a/src/entities/notification.rs +++ b/src/entities/notification.rs @@ -4,7 +4,7 @@ use super::{account::Account, status::Status}; use chrono::prelude::*; /// A struct containing info about a notification. -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, PartialEq)] pub struct Notification { /// The notification ID. pub id: String, @@ -20,7 +20,7 @@ pub struct Notification { } /// The type of notification. -#[derive(Debug, Clone, Copy, Deserialize)] +#[derive(Debug, Clone, Copy, Deserialize, PartialEq)] #[serde(rename_all = "lowercase")] pub enum NotificationType { /// Someone mentioned the application client in another status. diff --git a/src/entities/relationship.rs b/src/entities/relationship.rs index fd4eeab..35f3c99 100644 --- a/src/entities/relationship.rs +++ b/src/entities/relationship.rs @@ -2,7 +2,7 @@ //! another account. /// A struct containing information about a relationship with another account. -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, PartialEq)] pub struct Relationship { /// Target account id pub id: String, diff --git a/src/entities/report.rs b/src/entities/report.rs index b3bcdfd..2c3411b 100644 --- a/src/entities/report.rs +++ b/src/entities/report.rs @@ -1,7 +1,7 @@ //! module containing information about a finished report of a user. /// A struct containing info about a report. -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, PartialEq)] pub struct Report { /// The ID of the report. pub id: String, diff --git a/src/entities/search_result.rs b/src/entities/search_result.rs index db18fff..d2df4c3 100644 --- a/src/entities/search_result.rs +++ b/src/entities/search_result.rs @@ -6,7 +6,7 @@ use super::{ }; /// A struct containing results of a search. -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, PartialEq)] pub struct SearchResult { /// An array of matched Accounts. pub accounts: Vec, @@ -18,7 +18,7 @@ pub struct SearchResult { /// A struct containing results of a search, with `Tag` objects in the /// `hashtags` field -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, PartialEq)] pub struct SearchResultV2 { /// An array of matched Accounts. pub accounts: Vec, diff --git a/src/entities/status.rs b/src/entities/status.rs index eefdb91..8f8f318 100644 --- a/src/entities/status.rs +++ b/src/entities/status.rs @@ -5,7 +5,7 @@ use chrono::prelude::*; use status_builder::Visibility; /// A status from the instance. -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, PartialEq)] pub struct Status { /// The ID of the status. pub id: String, @@ -62,7 +62,7 @@ pub struct Status { } /// A mention of another user. -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, PartialEq)] pub struct Mention { /// URL of user's profile (can be remote). pub url: String, @@ -75,7 +75,7 @@ pub struct Mention { } /// Struct representing an emoji within text. -#[derive(Clone, Debug, Deserialize)] +#[derive(Clone, Debug, Deserialize, PartialEq)] pub struct Emoji { /// The shortcode of the emoji pub shortcode: String, @@ -86,7 +86,7 @@ pub struct Emoji { } /// Hashtags in the status. -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, PartialEq)] pub struct Tag { /// The hashtag, not including the preceding `#`. pub name: String, @@ -95,7 +95,7 @@ pub struct Tag { } /// Application details. -#[derive(Debug, Clone, Deserialize)] +#[derive(Debug, Clone, Deserialize, PartialEq)] pub struct Application { /// Name of the application. pub name: String,