From e1be16fba202b94f730ad490a5d8d3c640d1dc0c Mon Sep 17 00:00:00 2001 From: Waffle Date: Mon, 2 Sep 2019 14:24:23 +0300 Subject: [PATCH] Derive `PartialEq`, `Eq` and `Hash` on telegram types --- src/core/types/answer_pre_checkout_query.rs | 2 +- src/core/types/answer_shipping_query.rs | 2 +- src/core/types/chat.rs | 2 +- src/core/types/chat_permissions.rs | 2 +- src/core/types/chat_photo.rs | 2 +- src/core/types/document.rs | 2 +- src/core/types/invoice.rs | 2 +- src/core/types/label_price.rs | 2 +- src/core/types/message.rs | 2 +- src/core/types/order_info.rs | 2 +- src/core/types/pre_checkout_query.rs | 2 +- src/core/types/send_invoice.rs | 2 +- src/core/types/shipping_address.rs | 2 +- src/core/types/shipping_option.rs | 2 +- src/core/types/shipping_query.rs | 2 +- src/core/types/successful_payment.rs | 2 +- src/core/types/user.rs | 2 +- 17 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/core/types/answer_pre_checkout_query.rs b/src/core/types/answer_pre_checkout_query.rs index 42a9f680..708aea12 100644 --- a/src/core/types/answer_pre_checkout_query.rs +++ b/src/core/types/answer_pre_checkout_query.rs @@ -1,6 +1,6 @@ use serde::Deserialize; -#[derive(Debug, Deserialize)] +#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] pub struct AnswerPreCheckoutQuery { pub pre_checkout_query_id: String, pub ok: bool, diff --git a/src/core/types/answer_shipping_query.rs b/src/core/types/answer_shipping_query.rs index 6d89dfd7..bb7fa311 100644 --- a/src/core/types/answer_shipping_query.rs +++ b/src/core/types/answer_shipping_query.rs @@ -2,7 +2,7 @@ use serde::Deserialize; use crate::core::types::ShippingOption; -#[derive(Debug, Deserialize)] +#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] pub struct AnswerShippingQuery { pub shipping_query_id: String, pub ok: bool, diff --git a/src/core/types/chat.rs b/src/core/types/chat.rs index 9b05f39e..92b491f9 100644 --- a/src/core/types/chat.rs +++ b/src/core/types/chat.rs @@ -2,7 +2,7 @@ use serde::Deserialize; use crate::core::types::{ChatPermissions, ChatPhoto, Message}; -#[derive(Debug, Deserialize)] +#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] pub struct Chat { pub id: i64, pub chat_type: String, diff --git a/src/core/types/chat_permissions.rs b/src/core/types/chat_permissions.rs index 1b1cc56b..de09b983 100644 --- a/src/core/types/chat_permissions.rs +++ b/src/core/types/chat_permissions.rs @@ -1,6 +1,6 @@ use serde::Deserialize; -#[derive(Debug, Deserialize)] +#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] pub struct ChatPermissions { pub can_send_messages: Option, pub can_send_media_messages: Option, diff --git a/src/core/types/chat_photo.rs b/src/core/types/chat_photo.rs index d056e9e4..070ddfa2 100644 --- a/src/core/types/chat_photo.rs +++ b/src/core/types/chat_photo.rs @@ -1,6 +1,6 @@ use serde::Deserialize; -#[derive(Debug, Deserialize)] +#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] pub struct ChatPhoto { pub small_file_id: String, pub big_file_id: String, diff --git a/src/core/types/document.rs b/src/core/types/document.rs index 18d9a1f8..9b53bb32 100644 --- a/src/core/types/document.rs +++ b/src/core/types/document.rs @@ -1,6 +1,6 @@ use serde::Deserialize; -#[derive(Debug, Deserialize)] +#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] pub struct Document { pub file_id: String, pub thumb: Option, diff --git a/src/core/types/invoice.rs b/src/core/types/invoice.rs index 6dc29710..385465f1 100644 --- a/src/core/types/invoice.rs +++ b/src/core/types/invoice.rs @@ -1,6 +1,6 @@ use serde::Deserialize; -#[derive(Debug, Deserialize)] +#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] pub struct Invoice { pub title: String, pub description: String, diff --git a/src/core/types/label_price.rs b/src/core/types/label_price.rs index b05bedf0..f26a98bb 100644 --- a/src/core/types/label_price.rs +++ b/src/core/types/label_price.rs @@ -1,6 +1,6 @@ use serde::Deserialize; -#[derive(Debug, Deserialize)] +#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] pub struct LabeledPrice { pub label: String, pub amount: i64, diff --git a/src/core/types/message.rs b/src/core/types/message.rs index 406f0366..1d651192 100644 --- a/src/core/types/message.rs +++ b/src/core/types/message.rs @@ -2,7 +2,7 @@ use serde::Deserialize; use crate::core::types::{Chat, Document, Invoice, SuccessfulPayment, User}; -#[derive(Debug, Deserialize)] +#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] pub struct Message { pub message_id: i64, pub from: Option>, diff --git a/src/core/types/order_info.rs b/src/core/types/order_info.rs index e9619a30..e60af685 100644 --- a/src/core/types/order_info.rs +++ b/src/core/types/order_info.rs @@ -2,7 +2,7 @@ use serde::Deserialize; use crate::core::types::ShippingAddress; -#[derive(Debug, Deserialize)] +#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] pub struct OrderInfo { pub name: String, pub phone_number: String, diff --git a/src/core/types/pre_checkout_query.rs b/src/core/types/pre_checkout_query.rs index deb9ee08..85fb1252 100644 --- a/src/core/types/pre_checkout_query.rs +++ b/src/core/types/pre_checkout_query.rs @@ -2,7 +2,7 @@ use serde::Deserialize; use crate::core::types::{OrderInfo, User}; -#[derive(Debug, Deserialize)] +#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] pub struct PreCheckoutQuery { pub id: String, pub from: User, diff --git a/src/core/types/send_invoice.rs b/src/core/types/send_invoice.rs index 29cd0793..85d3381a 100644 --- a/src/core/types/send_invoice.rs +++ b/src/core/types/send_invoice.rs @@ -2,7 +2,7 @@ use serde::Deserialize; use crate::core::types::LabeledPrice; -#[derive(Debug, Deserialize)] +#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] pub struct SendInvoice { pub chat_id: i64, pub title: String, diff --git a/src/core/types/shipping_address.rs b/src/core/types/shipping_address.rs index f1434153..3f669ef8 100644 --- a/src/core/types/shipping_address.rs +++ b/src/core/types/shipping_address.rs @@ -1,6 +1,6 @@ use serde::Deserialize; -#[derive(Debug, Deserialize)] +#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] pub struct ShippingAddress { pub country_code: String, pub state: String, diff --git a/src/core/types/shipping_option.rs b/src/core/types/shipping_option.rs index b1782d26..7a9c5c21 100644 --- a/src/core/types/shipping_option.rs +++ b/src/core/types/shipping_option.rs @@ -2,7 +2,7 @@ use serde::Deserialize; use crate::core::types::LabeledPrice; -#[derive(Debug, Deserialize)] +#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] pub struct ShippingOption { pub id: i64, pub title: String, diff --git a/src/core/types/shipping_query.rs b/src/core/types/shipping_query.rs index 830e4020..96eec275 100644 --- a/src/core/types/shipping_query.rs +++ b/src/core/types/shipping_query.rs @@ -2,7 +2,7 @@ use serde::Deserialize; use crate::core::types::{ShippingAddress, User}; -#[derive(Debug, Deserialize)] +#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] pub struct ShippingQuery { pub id: String, pub from: User, diff --git a/src/core/types/successful_payment.rs b/src/core/types/successful_payment.rs index b766a2be..07e4de48 100644 --- a/src/core/types/successful_payment.rs +++ b/src/core/types/successful_payment.rs @@ -2,7 +2,7 @@ use serde::Deserialize; use crate::core::types::OrderInfo; -#[derive(Debug, Deserialize)] +#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] pub struct SuccessfulPayment { pub currency: String, pub total_amount: i64, diff --git a/src/core/types/user.rs b/src/core/types/user.rs index 31ef8992..0a6f6c43 100644 --- a/src/core/types/user.rs +++ b/src/core/types/user.rs @@ -1,6 +1,6 @@ use serde::Deserialize; -#[derive(Debug, Deserialize)] +#[derive(Debug, Deserialize, Hash, PartialEq, Eq)] pub struct User { pub id: i64, pub is_bot: bool,