Add derive(PartialEq) to all entities
This commit is contained in:
@@ -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<bool, D::Error> {
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
#[derive(Clone, Debug, Deserialize, PartialEq)]
|
||||
#[serde(untagged)]
|
||||
pub enum BoolOrString {
|
||||
Bool(bool),
|
||||
|
||||
@@ -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<ImageDetails>,
|
||||
@@ -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")]
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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<Status>,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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<Account>,
|
||||
@@ -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<Account>,
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user