Fix compile errors (many derives fixes and append_to_row (&mut mut))

This commit is contained in:
Waffle 2019-09-12 22:24:38 +03:00
parent 0d83c1b106
commit 7e297bb25e
9 changed files with 13 additions and 13 deletions

View file

@ -1,7 +1,7 @@
use crate::core::types::{ChatPermissions, ChatPhoto, Message}; use crate::core::types::{ChatPermissions, ChatPhoto, Message};
#[derive(Debug, Deserialize, PartialEq, Clone, Serialize)] #[derive(Debug, Deserialize, PartialEq, Clone)]
pub struct Chat { pub struct Chat {
pub id: i64, pub id: i64,
#[serde(flatten)] #[serde(flatten)]
@ -10,7 +10,7 @@ pub struct Chat {
} }
#[derive(Debug, Deserialize, PartialEq, Clone, Serialize)] #[derive(Debug, Deserialize, PartialEq, Clone)]
#[serde(untagged)] #[serde(untagged)]
pub enum ChatKind { pub enum ChatKind {
NonPrivate { NonPrivate {

View file

@ -2,7 +2,7 @@ use serde::Deserialize;
use crate::core::types::{MessageEntity, PhotoSize, Animation}; use crate::core::types::{MessageEntity, PhotoSize, Animation};
#[derive(Debug, Deserialize, Clone)] #[derive(Debug, Deserialize, Clone, PartialEq, Eq, Hash)]
/// This object represents a game. Use BotFather to create and edit games, their short names /// This object represents a game. Use BotFather to create and edit games, their short names
/// will act as unique identifiers. /// will act as unique identifiers.
pub struct Game { pub struct Game {

View file

@ -1,4 +1,4 @@
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone)] #[derive(Debug, Deserialize, PartialEq, Clone)]
pub struct MaskPosition { pub struct MaskPosition {
pub point: String, pub point: String,
pub x_shift: f64, pub x_shift: f64,

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, PartialEq, Clone, Serialize)] #[derive(Debug, Deserialize, PartialEq, Clone)]
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, PartialEq, Clone, Serialize)] #[derive(Debug, Deserialize, PartialEq, Clone)]
#[serde(untagged)] #[serde(untagged)]
pub enum MessageKind { pub enum MessageKind {
IncomingMessage { IncomingMessage {
@ -82,7 +82,7 @@ pub enum Sender {
Signature(String), Signature(String),
} }
#[derive(Debug, Deserialize, PartialEq, Clone, Serialize)] #[derive(Debug, Deserialize, PartialEq, Clone)]
#[serde(untagged)] #[serde(untagged)]
pub enum ForwardKind { pub enum ForwardKind {
ChannelForward { ChannelForward {
@ -114,7 +114,7 @@ pub enum ForwardedFrom {
SenderName(String), SenderName(String),
} }
#[derive(Debug, Deserialize, PartialEq, Clone, Serialize)] #[derive(Debug, Deserialize, PartialEq, Clone)]
#[serde(untagged)] #[serde(untagged)]
pub enum MediaKind { pub enum MediaKind {
Animation { Animation {

View file

@ -1,6 +1,6 @@
use crate::core::types::{MaskPosition, PhotoSize}; use crate::core::types::{MaskPosition, PhotoSize};
#[derive(Debug, Deserialize, Hash, PartialEq, Eq, Clone, Serialize)] #[derive(Debug, Deserialize, PartialEq, Clone)]
pub struct Sticker { pub struct Sticker {
pub file_id: String, pub file_id: String,
pub width: u16, pub width: u16,

View file

@ -2,7 +2,7 @@ use crate::core::types::Location;
/// This object represents a venue. /// This object represents a venue.
#[derive(Debug, Deserialize, Eq, Hash, PartialEq, Serialize, Clone)] #[derive(Debug, Deserialize, PartialEq, Serialize, Clone)]
pub struct Venue { pub struct Venue {
/// Venue location /// Venue location
pub location: Location, pub location: Location,

View file

@ -1,7 +1,7 @@
use serde::Deserialize; use serde::Deserialize;
use crate::core::types::PhotoSize; use crate::core::types::PhotoSize;
#[derive(Debug, Deserialize, Clone)] #[derive(Debug, Deserialize, Clone, PartialEq, Eq, Hash)]
/// This object represents a [video message](https://telegram.org/blog/video-messages-and-telescope) /// This object represents a [video message](https://telegram.org/blog/video-messages-and-telescope)
/// (available in Telegram apps as of v.4.0). /// (available in Telegram apps as of v.4.0).
pub struct VideoNote { pub struct VideoNote {

View file

@ -1,6 +1,6 @@
use serde::Deserialize; use serde::Deserialize;
#[derive(Debug, Deserialize, Clone)] #[derive(Debug, Deserialize, Clone, PartialEq, Eq, Hash)]
/// This object represents a voice note. /// This object represents a voice note.
pub struct Voice { pub struct Voice {
/// Identifier for this file /// Identifier for this file

View file

@ -37,7 +37,7 @@ impl InlineKeyboardMarkupBuilder {
pub fn append_to_row(mut self, button: InlineKeyboardButton, index: usize) pub fn append_to_row(mut self, button: InlineKeyboardButton, index: usize)
-> Self { -> Self {
match self.keyboard.inline_keyboard.get_mut(index) { match self.keyboard.inline_keyboard.get_mut(index) {
Some(&mut mut buttons) => buttons.push(button), Some(buttons) => buttons.push(button),
None => self.keyboard.inline_keyboard.push(vec![button]) None => self.keyboard.inline_keyboard.push(vec![button])
}; };
self self