Derive PartialEq, Eq and Hash on telegram types

This commit is contained in:
Waffle 2019-09-02 14:24:23 +03:00
parent 65f153734d
commit e1be16fba2
17 changed files with 17 additions and 17 deletions

View file

@ -1,6 +1,6 @@
use serde::Deserialize; use serde::Deserialize;
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct AnswerPreCheckoutQuery { pub struct AnswerPreCheckoutQuery {
pub pre_checkout_query_id: String, pub pre_checkout_query_id: String,
pub ok: bool, pub ok: bool,

View file

@ -2,7 +2,7 @@ use serde::Deserialize;
use crate::core::types::ShippingOption; use crate::core::types::ShippingOption;
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct AnswerShippingQuery { pub struct AnswerShippingQuery {
pub shipping_query_id: String, pub shipping_query_id: String,
pub ok: bool, pub ok: bool,

View file

@ -2,7 +2,7 @@ use serde::Deserialize;
use crate::core::types::{ChatPermissions, ChatPhoto, Message}; use crate::core::types::{ChatPermissions, ChatPhoto, Message};
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct Chat { pub struct Chat {
pub id: i64, pub id: i64,
pub chat_type: String, pub chat_type: String,

View file

@ -1,6 +1,6 @@
use serde::Deserialize; use serde::Deserialize;
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct ChatPermissions { pub struct ChatPermissions {
pub can_send_messages: Option<bool>, pub can_send_messages: Option<bool>,
pub can_send_media_messages: Option<bool>, pub can_send_media_messages: Option<bool>,

View file

@ -1,6 +1,6 @@
use serde::Deserialize; use serde::Deserialize;
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct ChatPhoto { pub struct ChatPhoto {
pub small_file_id: String, pub small_file_id: String,
pub big_file_id: String, pub big_file_id: String,

View file

@ -1,6 +1,6 @@
use serde::Deserialize; use serde::Deserialize;
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct Document { pub struct Document {
pub file_id: String, pub file_id: String,
pub thumb: Option<PhotoSize>, pub thumb: Option<PhotoSize>,

View file

@ -1,6 +1,6 @@
use serde::Deserialize; use serde::Deserialize;
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct Invoice { pub struct Invoice {
pub title: String, pub title: String,
pub description: String, pub description: String,

View file

@ -1,6 +1,6 @@
use serde::Deserialize; use serde::Deserialize;
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct LabeledPrice { pub struct LabeledPrice {
pub label: String, pub label: String,
pub amount: i64, pub amount: i64,

View file

@ -2,7 +2,7 @@ use serde::Deserialize;
use crate::core::types::{Chat, Document, Invoice, SuccessfulPayment, User}; use crate::core::types::{Chat, Document, Invoice, SuccessfulPayment, User};
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct Message { pub struct Message {
pub message_id: i64, pub message_id: i64,
pub from: Option<Box<User>>, pub from: Option<Box<User>>,

View file

@ -2,7 +2,7 @@ use serde::Deserialize;
use crate::core::types::ShippingAddress; use crate::core::types::ShippingAddress;
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct OrderInfo { pub struct OrderInfo {
pub name: String, pub name: String,
pub phone_number: String, pub phone_number: String,

View file

@ -2,7 +2,7 @@ use serde::Deserialize;
use crate::core::types::{OrderInfo, User}; use crate::core::types::{OrderInfo, User};
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct PreCheckoutQuery { pub struct PreCheckoutQuery {
pub id: String, pub id: String,
pub from: User, pub from: User,

View file

@ -2,7 +2,7 @@ use serde::Deserialize;
use crate::core::types::LabeledPrice; use crate::core::types::LabeledPrice;
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct SendInvoice { pub struct SendInvoice {
pub chat_id: i64, pub chat_id: i64,
pub title: String, pub title: String,

View file

@ -1,6 +1,6 @@
use serde::Deserialize; use serde::Deserialize;
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct ShippingAddress { pub struct ShippingAddress {
pub country_code: String, pub country_code: String,
pub state: String, pub state: String,

View file

@ -2,7 +2,7 @@ use serde::Deserialize;
use crate::core::types::LabeledPrice; use crate::core::types::LabeledPrice;
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct ShippingOption { pub struct ShippingOption {
pub id: i64, pub id: i64,
pub title: String, pub title: String,

View file

@ -2,7 +2,7 @@ use serde::Deserialize;
use crate::core::types::{ShippingAddress, User}; use crate::core::types::{ShippingAddress, User};
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct ShippingQuery { pub struct ShippingQuery {
pub id: String, pub id: String,
pub from: User, pub from: User,

View file

@ -2,7 +2,7 @@ use serde::Deserialize;
use crate::core::types::OrderInfo; use crate::core::types::OrderInfo;
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct SuccessfulPayment { pub struct SuccessfulPayment {
pub currency: String, pub currency: String,
pub total_amount: i64, pub total_amount: i64,

View file

@ -1,6 +1,6 @@
use serde::Deserialize; use serde::Deserialize;
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize, Hash, PartialEq, Eq)]
pub struct User { pub struct User {
pub id: i64, pub id: i64,
pub is_bot: bool, pub is_bot: bool,