Little bit of refactoring

This commit is contained in:
Mr-Andersen 2019-09-12 16:03:04 +03:00
parent 383d17ef47
commit 7482534335
2 changed files with 8 additions and 6 deletions

View file

@ -4,7 +4,7 @@ use crate::core::types::{
SuccessfulPayment, User, Venue, Video, VideoNote, Voice, SuccessfulPayment, User, Venue, Video, VideoNote, Voice,
}; };
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Clone, Serialize)] #[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
pub struct Message { pub struct Message {
#[serde(rename = "message_id")] #[serde(rename = "message_id")]
pub id: i64, pub id: i64,
@ -14,7 +14,7 @@ pub struct Message {
pub message_kind: MessageKind, pub message_kind: MessageKind,
} }
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Clone, Serialize)] #[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
#[serde(untagged)] #[serde(untagged)]
pub enum MessageKind { pub enum MessageKind {
IncomingMessage { IncomingMessage {
@ -72,7 +72,7 @@ pub enum MessageKind {
}, },
} }
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Clone, Serialize)] #[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
pub enum Sender { pub enum Sender {
/// If message is sent from Chat /// If message is sent from Chat
#[serde(rename = "from")] #[serde(rename = "from")]
@ -82,7 +82,7 @@ pub enum Sender {
Signature(String), Signature(String),
} }
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Clone, Serialize)] #[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
#[serde(untagged)] #[serde(untagged)]
pub enum ForwardKind { pub enum ForwardKind {
ChannelForward { ChannelForward {
@ -106,7 +106,7 @@ pub enum ForwardKind {
}, },
} }
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Clone, Serialize)] #[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
pub enum ForwardedFrom { pub enum ForwardedFrom {
#[serde(rename = "forward_from")] #[serde(rename = "forward_from")]
User(User), User(User),
@ -114,7 +114,7 @@ pub enum ForwardedFrom {
SenderName(String), SenderName(String),
} }
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Clone, Serialize)] #[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
#[serde(untagged)] #[serde(untagged)]
pub enum MediaKind { pub enum MediaKind {
Animation { Animation {

View file

@ -19,6 +19,7 @@ pub use self::{
order_info::OrderInfo, order_info::OrderInfo,
parse_mode::ParseMode, parse_mode::ParseMode,
photo_size::PhotoSize, photo_size::PhotoSize,
poll::{Poll, PollOption},
pre_checkout_query::PreCheckoutQuery, pre_checkout_query::PreCheckoutQuery,
response_parameters::ResponseParameters, response_parameters::ResponseParameters,
send_invoice::SendInvoice, send_invoice::SendInvoice,
@ -60,6 +61,7 @@ mod not_implemented_types;
mod order_info; mod order_info;
mod parse_mode; mod parse_mode;
mod photo_size; mod photo_size;
mod poll;
mod pre_checkout_query; mod pre_checkout_query;
mod response_parameters; mod response_parameters;
mod reply_markup; mod reply_markup;