diff --git a/src/types/allowed_update.rs b/src/types/allowed_update.rs index 932f053e..f3b920ac 100644 --- a/src/types/allowed_update.rs +++ b/src/types/allowed_update.rs @@ -2,6 +2,7 @@ use serde::{Deserialize, Serialize}; #[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] +#[non_exhaustive] pub enum AllowedUpdate { Message, EditedMessage, diff --git a/src/types/animation.rs b/src/types/animation.rs index 54694665..ad39e4a3 100644 --- a/src/types/animation.rs +++ b/src/types/animation.rs @@ -8,6 +8,7 @@ use crate::types::{MimeWrapper, PhotoSize}; /// [The official docs](https://core.telegram.org/bots/api#animation). #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct Animation { /// An identifier for this file. pub file_id: String, diff --git a/src/types/audio.rs b/src/types/audio.rs index b34d8a62..6388056a 100644 --- a/src/types/audio.rs +++ b/src/types/audio.rs @@ -8,6 +8,7 @@ use crate::types::{MimeWrapper, PhotoSize}; /// [The official docs](https://core.telegram.org/bots/api#audio). #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct Audio { /// An identifier for this file. pub file_id: String, diff --git a/src/types/callback_game.rs b/src/types/callback_game.rs index 0fd9a9b0..5b2d6e0f 100644 --- a/src/types/callback_game.rs +++ b/src/types/callback_game.rs @@ -9,4 +9,5 @@ use serde::{Deserialize, Serialize}; /// /// [@Botfather]: https://t.me/botfather #[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct CallbackGame; diff --git a/src/types/callback_query.rs b/src/types/callback_query.rs index 47cedb96..60c4f3b4 100644 --- a/src/types/callback_query.rs +++ b/src/types/callback_query.rs @@ -17,6 +17,7 @@ use crate::types::{Message, User}; /// [inline mode]: https://core.telegram.org/bots/api#inline-mode #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct CallbackQuery { /// An unique identifier for this query. pub id: String, diff --git a/src/types/chat.rs b/src/types/chat.rs index cf7645e2..5835317b 100644 --- a/src/types/chat.rs +++ b/src/types/chat.rs @@ -7,6 +7,7 @@ use crate::types::{ChatPermissions, ChatPhoto, Message}; /// [The official docs](https://core.telegram.org/bots/api#chat). #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct Chat { /// A unique identifier for this chat. This number may be greater than 32 /// bits and some programming languages may have difficulty/silent defects @@ -27,6 +28,7 @@ pub struct Chat { #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(untagged)] +#[non_exhaustive] pub enum ChatKind { Public(ChatPublic), Private(ChatPrivate), @@ -34,6 +36,7 @@ pub enum ChatKind { #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct ChatPublic { /// A title, for supergroups, channels and group chats. pub title: Option, @@ -68,6 +71,7 @@ pub struct ChatPublic { #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct ChatPrivate { /// A dummy field. Used to ensure that the `type` field is equal to /// `private`. @@ -90,6 +94,7 @@ pub struct ChatPrivate { #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] #[serde(tag = "type")] +#[non_exhaustive] pub enum PublicChatKind { Channel(PublicChatChannel), Group(PublicChatGroup), @@ -98,6 +103,7 @@ pub enum PublicChatKind { #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct PublicChatChannel { /// A username, for private chats, supergroups and channels if available. pub username: Option, @@ -105,6 +111,7 @@ pub struct PublicChatChannel { #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct PublicChatGroup { /// A default chat member permissions, for groups and supergroups. Returned /// only from [`Bot::get_chat`]. @@ -115,6 +122,7 @@ pub struct PublicChatGroup { #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct PublicChatSupergroup { /// A username, for private chats, supergroups and channels if /// available. diff --git a/src/types/chat_action.rs b/src/types/chat_action.rs index a73887ea..9c112a56 100644 --- a/src/types/chat_action.rs +++ b/src/types/chat_action.rs @@ -2,6 +2,7 @@ use serde::{Deserialize, Serialize}; #[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] +#[non_exhaustive] pub enum ChatAction { Typing, UploadPhoto, diff --git a/src/types/chat_id.rs b/src/types/chat_id.rs index f4e57e98..f5723da0 100644 --- a/src/types/chat_id.rs +++ b/src/types/chat_id.rs @@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize}; /// (in the format `@channelusername`). #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, Display, From)] #[serde(untagged)] +#[non_exhaustive] pub enum ChatId { /// A chat identifier. #[display(fmt = "{}", _0)] diff --git a/src/types/chat_member.rs b/src/types/chat_member.rs index 8bae0e83..7ab566b0 100644 --- a/src/types/chat_member.rs +++ b/src/types/chat_member.rs @@ -7,6 +7,7 @@ use crate::types::User; /// /// [The official docs](https://core.telegram.org/bots/api#chatmember). #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct ChatMember { /// Information about the user. pub user: User, diff --git a/src/types/chat_or_inline_message.rs b/src/types/chat_or_inline_message.rs index 9f4d5702..d02a522b 100644 --- a/src/types/chat_or_inline_message.rs +++ b/src/types/chat_or_inline_message.rs @@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize}; /// A chat message or inline message. #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] #[serde(untagged)] +#[non_exhaustive] pub enum ChatOrInlineMessage { Chat { chat_id: ChatId, message_id: i32 }, Inline { inline_message_id: i32 }, diff --git a/src/types/chat_permissions.rs b/src/types/chat_permissions.rs index a39314ea..98e920f5 100644 --- a/src/types/chat_permissions.rs +++ b/src/types/chat_permissions.rs @@ -5,7 +5,8 @@ use serde::{Deserialize, Serialize}; /// /// [The official docs](https://core.telegram.org/bots/api#chatpermissions). #[serde_with_macros::skip_serializing_none] -#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[derive(Copy, Clone, Default, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct ChatPermissions { /// `true`, if the user is allowed to send text messages, contacts, /// locations and venues. @@ -39,18 +40,3 @@ pub struct ChatPermissions { /// supergroups. pub can_pin_messages: Option, } - -impl Default for ChatPermissions { - fn default() -> Self { - Self { - can_send_messages: None, - can_send_media_messages: None, - can_send_polls: None, - can_send_other_messages: None, - can_add_web_page_previews: None, - can_change_info: None, - can_invite_users: None, - can_pin_messages: None, - } - } -} diff --git a/src/types/chat_photo.rs b/src/types/chat_photo.rs index 3ebd2bb6..d15f96d1 100644 --- a/src/types/chat_photo.rs +++ b/src/types/chat_photo.rs @@ -4,6 +4,7 @@ use serde::{Deserialize, Serialize}; /// /// [The official docs](https://core.telegram.org/bots/api#chatphoto). #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct ChatPhoto { /// A file identifier of small (160x160) chat photo. This file_id can be /// used only for photo download and only for as long as the photo is diff --git a/src/types/chosen_inline_result.rs b/src/types/chosen_inline_result.rs index 458ec465..db985fd5 100644 --- a/src/types/chosen_inline_result.rs +++ b/src/types/chosen_inline_result.rs @@ -10,6 +10,7 @@ use crate::types::{Location, User}; /// [result]: https://core.telegram.org/bots/api#inlinequeryresult #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct ChosenInlineResult { /// The unique identifier for the result that was chosen. pub result_id: String, diff --git a/src/types/contact.rs b/src/types/contact.rs index 147d31dd..9c5f5abf 100644 --- a/src/types/contact.rs +++ b/src/types/contact.rs @@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize}; /// [The official docs](https://core.telegram.org/bots/api#contact). #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct Contact { /// A contact's phone number. pub phone_number: String, diff --git a/src/types/document.rs b/src/types/document.rs index 6fcfcca5..1279c546 100644 --- a/src/types/document.rs +++ b/src/types/document.rs @@ -12,6 +12,7 @@ use crate::types::{MimeWrapper, PhotoSize}; /// [audio files]: https://core.telegram.org/bots/api#audio #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct Document { /// An identifier for this file. pub file_id: String, diff --git a/src/types/encrypted_credentials.rs b/src/types/encrypted_credentials.rs index 583821e7..aecaa0a5 100644 --- a/src/types/encrypted_credentials.rs +++ b/src/types/encrypted_credentials.rs @@ -13,6 +13,7 @@ use serde::{Deserialize, Serialize}; /// [Telegram Passport Documentation]: https://core.telegram.org/passport#receiving-information #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct EncryptedCredentials { /// Base64-encoded encrypted JSON-serialized data with unique user's /// payload, data hashes and secrets required for diff --git a/src/types/encrypted_passport_element.rs b/src/types/encrypted_passport_element.rs index d03eca1b..a391ed95 100644 --- a/src/types/encrypted_passport_element.rs +++ b/src/types/encrypted_passport_element.rs @@ -7,6 +7,7 @@ use super::PassportFile; /// /// [The official docs](https://core.telegram.org/bots/api#encryptedpassportelement). #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct EncryptedPassportElement { /// Base64-encoded element hash for using in /// [`PassportElementErrorKind::Unspecified`]. @@ -22,6 +23,7 @@ pub struct EncryptedPassportElement { #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] #[allow(clippy::large_enum_variant)] +#[non_exhaustive] pub enum EncryptedPassportElementKind { PersonalDetails(EncryptedPassportElementPersonalDetails), Passport(EncryptedPassportElementPassport), @@ -40,6 +42,7 @@ pub enum EncryptedPassportElementKind { #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct EncryptedPassportElementPersonalDetails { /// Base64-encoded encrypted Telegram Passport element data provided /// by the user, available for `personal_details`, `passport`, @@ -54,6 +57,7 @@ pub struct EncryptedPassportElementPersonalDetails { #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct EncryptedPassportElementPassport { /// Base64-encoded encrypted Telegram Passport element data provided /// by the user, available for `personal_details`, `passport`, @@ -98,6 +102,7 @@ pub struct EncryptedPassportElementPassport { #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct EncryptedPassportElementDriverLicense { /// Base64-encoded encrypted Telegram Passport element data provided /// by the user, available for `personal_details`, `passport`, @@ -151,6 +156,7 @@ pub struct EncryptedPassportElementDriverLicense { #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct EncryptedPassportElementIdentityCard { /// Base64-encoded encrypted Telegram Passport element data provided /// by the user, available for `personal_details`, `passport`, @@ -204,7 +210,7 @@ pub struct EncryptedPassportElementIdentityCard { #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] - +#[non_exhaustive] pub struct EncryptedPassportElementInternalPassport { /// Base64-encoded encrypted Telegram Passport element data provided /// by the user, available for `personal_details`, `passport`, @@ -249,6 +255,7 @@ pub struct EncryptedPassportElementInternalPassport { #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct EncryptedPassportElementAddress { /// Base64-encoded encrypted Telegram Passport element data provided /// by the user, available for `personal_details`, `passport`, @@ -263,6 +270,7 @@ pub struct EncryptedPassportElementAddress { #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct EncryptedPassportElementUtilityBill { /// Array of encrypted files with documents provided by the user, /// available for `utility_bill`, `bank_statement`, `rental_agreement`, @@ -289,7 +297,7 @@ pub struct EncryptedPassportElementUtilityBill { #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] - +#[non_exhaustive] pub struct EncryptedPassportElementBankStatement { /// Array of encrypted files with documents provided by the user, /// available for `utility_bill`, `bank_statement`, `rental_agreement`, @@ -316,6 +324,7 @@ pub struct EncryptedPassportElementBankStatement { #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct EncryptedPassportElementRentalAgreement { /// Array of encrypted files with documents provided by the user, /// available for `utility_bill`, `bank_statement`, `rental_agreement`, @@ -342,7 +351,7 @@ pub struct EncryptedPassportElementRentalAgreement { #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] - +#[non_exhaustive] pub struct EncryptedPassportElementPassportRegistration { /// Array of encrypted files with documents provided by the user, /// available for `utility_bill`, `bank_statement`, `rental_agreement`, @@ -369,6 +378,7 @@ pub struct EncryptedPassportElementPassportRegistration { #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct EncryptedPassportElementTemporaryRegistration { /// Array of encrypted files with documents provided by the user, /// available for `utility_bill`, `bank_statement`, `rental_agreement`, @@ -395,6 +405,7 @@ pub struct EncryptedPassportElementTemporaryRegistration { #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct EncryptedPassportElementPhoneNumber { /// User's verified phone number, available only for `phone_number` /// type. @@ -403,7 +414,7 @@ pub struct EncryptedPassportElementPhoneNumber { #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] - +#[non_exhaustive] pub struct EncryptedPassportElementEmail { /// User's verified email address, available only for `email` type. pub email: String, diff --git a/src/types/file.rs b/src/types/file.rs index 385a3930..625fd528 100644 --- a/src/types/file.rs +++ b/src/types/file.rs @@ -10,6 +10,7 @@ use serde::{Deserialize, Serialize}; /// /// [`Bot::get_file`]: crate::Bot::get_file #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct File { /// Identifier for this file. pub file_id: String, diff --git a/src/types/force_reply.rs b/src/types/force_reply.rs index bd3fc44a..07742910 100644 --- a/src/types/force_reply.rs +++ b/src/types/force_reply.rs @@ -14,6 +14,7 @@ use crate::types::True; /// [privacy mode]: https://core.telegram.org/bots#privacy-mode #[serde_with_macros::skip_serializing_none] #[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct ForceReply { /// Shows reply interface to the user, as if they manually selected the /// bot‘s message and tapped ’Reply'. diff --git a/src/types/game.rs b/src/types/game.rs index bd28d5c6..c1163144 100644 --- a/src/types/game.rs +++ b/src/types/game.rs @@ -10,6 +10,7 @@ use crate::types::{Animation, MessageEntity, PhotoSize}; /// [@Botfather]: https://t.me/botfather #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct Game { /// Title of the game. pub title: String, diff --git a/src/types/game_high_score.rs b/src/types/game_high_score.rs index 059686c1..2d59ae8c 100644 --- a/src/types/game_high_score.rs +++ b/src/types/game_high_score.rs @@ -6,6 +6,7 @@ use crate::types::user::User; /// /// [The official docs](https://core.telegram.org/bots/api#gamehighscore). #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct GameHighScore { /// Position in high score table for the game. pub position: u32, diff --git a/src/types/inline_keyboard_button.rs b/src/types/inline_keyboard_button.rs index 296c07cd..5b13adc6 100644 --- a/src/types/inline_keyboard_button.rs +++ b/src/types/inline_keyboard_button.rs @@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize}; /// /// [The official docs](https://core.telegram.org/bots/api#inlinekeyboardbutton). #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct InlineKeyboardButton { /// Label text on the button. pub text: String, @@ -15,6 +16,7 @@ pub struct InlineKeyboardButton { #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] +#[non_exhaustive] pub enum InlineKeyboardButtonKind { /// HTTP or tg:// url to be opened when button is pressed. Url(String), diff --git a/src/types/inline_keyboard_markup.rs b/src/types/inline_keyboard_markup.rs index eeb73046..bd4810ad 100644 --- a/src/types/inline_keyboard_markup.rs +++ b/src/types/inline_keyboard_markup.rs @@ -12,6 +12,7 @@ use crate::types::InlineKeyboardButton; /// /// [inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, Default)] +#[non_exhaustive] pub struct InlineKeyboardMarkup { /// Array of button rows, each represented by an array of /// [`InlineKeyboardButton`] objects. diff --git a/src/types/inline_query.rs b/src/types/inline_query.rs index 8b2ab03d..c7eaa34e 100644 --- a/src/types/inline_query.rs +++ b/src/types/inline_query.rs @@ -10,6 +10,7 @@ use crate::types::{Location, User}; /// [The official docs](https://core.telegram.org/bots/api#inlinequery). #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct InlineQuery { /// Unique identifier for this query. pub id: String, diff --git a/src/types/inline_query_result.rs b/src/types/inline_query_result.rs index e295bd15..cb9976de 100644 --- a/src/types/inline_query_result.rs +++ b/src/types/inline_query_result.rs @@ -19,6 +19,7 @@ use crate::types::{ #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, From)] #[serde(tag = "type")] #[serde(rename_all = "snake_case")] +#[non_exhaustive] pub enum InlineQueryResult { #[serde(rename = "audio")] CachedAudio(InlineQueryResultCachedAudio), diff --git a/src/types/inline_query_result_article.rs b/src/types/inline_query_result_article.rs index df8268a8..8ef6e6ce 100644 --- a/src/types/inline_query_result_article.rs +++ b/src/types/inline_query_result_article.rs @@ -7,6 +7,7 @@ use crate::types::{InlineKeyboardMarkup, InputMessageContent}; /// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultarticle). #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct InlineQueryResultArticle { /// Unique identifier for this result, 1-64 Bytes. pub id: String, diff --git a/src/types/inline_query_result_audio.rs b/src/types/inline_query_result_audio.rs index 9d9c1077..a64051c8 100644 --- a/src/types/inline_query_result_audio.rs +++ b/src/types/inline_query_result_audio.rs @@ -11,6 +11,7 @@ use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode}; /// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultaudio). #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct InlineQueryResultAudio { /// Unique identifier for this result, 1-64 bytes. pub id: String, diff --git a/src/types/inline_query_result_cached_audio.rs b/src/types/inline_query_result_cached_audio.rs index 47c2b4de..31b5b60a 100644 --- a/src/types/inline_query_result_cached_audio.rs +++ b/src/types/inline_query_result_cached_audio.rs @@ -11,6 +11,7 @@ use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode}; /// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultcachedaudio). #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct InlineQueryResultCachedAudio { /// Unique identifier for this result, 1-64 bytes. pub id: String, diff --git a/src/types/inline_query_result_cached_document.rs b/src/types/inline_query_result_cached_document.rs index b6c9acf6..e2040410 100644 --- a/src/types/inline_query_result_cached_document.rs +++ b/src/types/inline_query_result_cached_document.rs @@ -11,6 +11,7 @@ use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode}; /// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultcacheddocument). #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct InlineQueryResultCachedDocument { /// Unique identifier for this result, 1-64 bytes. pub id: String, diff --git a/src/types/inline_query_result_cached_gif.rs b/src/types/inline_query_result_cached_gif.rs index 5281cccb..0e73388c 100644 --- a/src/types/inline_query_result_cached_gif.rs +++ b/src/types/inline_query_result_cached_gif.rs @@ -11,6 +11,7 @@ use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode}; /// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultcachedgif). #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct InlineQueryResultCachedGif { /// Unique identifier for this result, 1-64 bytes. pub id: String, diff --git a/src/types/inline_query_result_cached_mpeg4_gif.rs b/src/types/inline_query_result_cached_mpeg4_gif.rs index 010d2fd1..d614fb14 100644 --- a/src/types/inline_query_result_cached_mpeg4_gif.rs +++ b/src/types/inline_query_result_cached_mpeg4_gif.rs @@ -12,6 +12,7 @@ use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode}; /// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultcachedmpeg4gif). #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct InlineQueryResultCachedMpeg4Gif { /// Unique identifier for this result, 1-64 bytes. pub id: String, diff --git a/src/types/inline_query_result_cached_photo.rs b/src/types/inline_query_result_cached_photo.rs index d528e33c..d5b26b22 100644 --- a/src/types/inline_query_result_cached_photo.rs +++ b/src/types/inline_query_result_cached_photo.rs @@ -11,6 +11,7 @@ use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode}; /// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultcachedphoto). #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct InlineQueryResultCachedPhoto { /// Unique identifier for this result, 1-64 bytes. pub id: String, diff --git a/src/types/inline_query_result_cached_sticker.rs b/src/types/inline_query_result_cached_sticker.rs index 75437e5a..15876438 100644 --- a/src/types/inline_query_result_cached_sticker.rs +++ b/src/types/inline_query_result_cached_sticker.rs @@ -11,6 +11,7 @@ use crate::types::{InlineKeyboardMarkup, InputMessageContent}; /// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultcachedsticker). #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct InlineQueryResultCachedSticker { /// Unique identifier for this result, 1-64 bytes. pub id: String, diff --git a/src/types/inline_query_result_cached_video.rs b/src/types/inline_query_result_cached_video.rs index 57ba728e..3c3d9762 100644 --- a/src/types/inline_query_result_cached_video.rs +++ b/src/types/inline_query_result_cached_video.rs @@ -11,6 +11,7 @@ use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode}; /// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultcachedvideo). #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct InlineQueryResultCachedVideo { /// Unique identifier for this result, 1-64 bytes. pub id: String, diff --git a/src/types/inline_query_result_cached_voice.rs b/src/types/inline_query_result_cached_voice.rs index 354f11f3..971fa546 100644 --- a/src/types/inline_query_result_cached_voice.rs +++ b/src/types/inline_query_result_cached_voice.rs @@ -11,6 +11,7 @@ use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode}; /// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultcachedvideo). #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct InlineQueryResultCachedVoice { /// Unique identifier for this result, 1-64 bytes. pub id: String, diff --git a/src/types/inline_query_result_contact.rs b/src/types/inline_query_result_contact.rs index 819bbd75..d10d4a3e 100644 --- a/src/types/inline_query_result_contact.rs +++ b/src/types/inline_query_result_contact.rs @@ -11,6 +11,7 @@ use crate::types::{InlineKeyboardMarkup, InputMessageContent}; /// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultcachedvideo). #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct InlineQueryResultContact { /// Unique identifier for this result, 1-64 Bytes. pub id: String, diff --git a/src/types/inline_query_result_document.rs b/src/types/inline_query_result_document.rs index d4a4462d..5027edcb 100644 --- a/src/types/inline_query_result_document.rs +++ b/src/types/inline_query_result_document.rs @@ -12,6 +12,7 @@ use crate::types::{InlineKeyboardMarkup, InputMessageContent, MimeWrapper, Parse /// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultdocument). #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct InlineQueryResultDocument { /// Unique identifier for this result, 1-64 bytes. pub id: String, diff --git a/src/types/inline_query_result_game.rs b/src/types/inline_query_result_game.rs index 34467014..9f86b0f9 100644 --- a/src/types/inline_query_result_game.rs +++ b/src/types/inline_query_result_game.rs @@ -9,6 +9,7 @@ use crate::types::InlineKeyboardMarkup; /// [game]: https://core.telegram.org/bots/api#games #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct InlineQueryResultGame { /// Unique identifier for this result, 1-64 bytes. pub id: String, diff --git a/src/types/inline_query_result_gif.rs b/src/types/inline_query_result_gif.rs index 3f0f8500..dc155da6 100644 --- a/src/types/inline_query_result_gif.rs +++ b/src/types/inline_query_result_gif.rs @@ -11,6 +11,7 @@ use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode}; /// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultgif). #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct InlineQueryResultGif { /// Unique identifier for this result, 1-64 bytes. pub id: String, diff --git a/src/types/inline_query_result_location.rs b/src/types/inline_query_result_location.rs index e5ed5d4e..fdaf5784 100644 --- a/src/types/inline_query_result_location.rs +++ b/src/types/inline_query_result_location.rs @@ -11,6 +11,7 @@ use crate::types::{InlineKeyboardMarkup, InputMessageContent}; /// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultlocation). #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct InlineQueryResultLocation { /// Unique identifier for this result, 1-64 Bytes. pub id: String, diff --git a/src/types/inline_query_result_mpeg4_gif.rs b/src/types/inline_query_result_mpeg4_gif.rs index d9f50e70..d83f5ab4 100644 --- a/src/types/inline_query_result_mpeg4_gif.rs +++ b/src/types/inline_query_result_mpeg4_gif.rs @@ -12,6 +12,7 @@ use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode}; /// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultmpeg4gif). #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct InlineQueryResultMpeg4Gif { /// Unique identifier for this result, 1-64 bytes. pub id: String, diff --git a/src/types/inline_query_result_photo.rs b/src/types/inline_query_result_photo.rs index 8b08c267..a5a4aeac 100644 --- a/src/types/inline_query_result_photo.rs +++ b/src/types/inline_query_result_photo.rs @@ -11,6 +11,7 @@ use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode}; /// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultphoto). #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct InlineQueryResultPhoto { /// Unique identifier for this result, 1-64 bytes. pub id: String, diff --git a/src/types/inline_query_result_venue.rs b/src/types/inline_query_result_venue.rs index 46485a88..29c370e7 100644 --- a/src/types/inline_query_result_venue.rs +++ b/src/types/inline_query_result_venue.rs @@ -11,6 +11,7 @@ use crate::types::{InlineKeyboardMarkup, InputMessageContent}; /// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultvenue). #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct InlineQueryResultVenue { /// Unique identifier for this result, 1-64 Bytes. pub id: String, diff --git a/src/types/inline_query_result_video.rs b/src/types/inline_query_result_video.rs index 28d443c9..f356b5dd 100644 --- a/src/types/inline_query_result_video.rs +++ b/src/types/inline_query_result_video.rs @@ -12,6 +12,7 @@ use crate::types::{InlineKeyboardMarkup, InputMessageContent, MimeWrapper, Parse /// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultvideo). #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct InlineQueryResultVideo { /// Unique identifier for this result, 1-64 bytes. pub id: String, diff --git a/src/types/inline_query_result_voice.rs b/src/types/inline_query_result_voice.rs index efd6aaa2..4cae0068 100644 --- a/src/types/inline_query_result_voice.rs +++ b/src/types/inline_query_result_voice.rs @@ -12,6 +12,7 @@ use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode}; /// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultvoice). #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct InlineQueryResultVoice { /// Unique identifier for this result, 1-64 bytes. pub id: String, diff --git a/src/types/input_file.rs b/src/types/input_file.rs index 6c948f4b..55e15e14 100644 --- a/src/types/input_file.rs +++ b/src/types/input_file.rs @@ -6,6 +6,7 @@ use std::{borrow::Cow, path::PathBuf}; /// /// [The official docs](https://core.telegram.org/bots/api#inputfile). #[derive(Clone, Debug, Eq, Hash, PartialEq, Deserialize)] +#[non_exhaustive] pub enum InputFile { File(PathBuf), Memory { file_name: String, data: Cow<'static, [u8]> }, diff --git a/src/types/input_media.rs b/src/types/input_media.rs index a7b8daa8..78ece953 100644 --- a/src/types/input_media.rs +++ b/src/types/input_media.rs @@ -2,13 +2,13 @@ use serde::{Deserialize, Serialize}; use crate::types::{InputFile, ParseMode}; -// TODO: should variants use new-type? -#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] -#[serde(tag = "type")] -#[serde(rename_all = "snake_case")] /// This object represents the content of a media message to be sent. /// /// [The official docs](https://core.telegram.org/bots/api#inputmedia). +#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[serde(tag = "type")] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] pub enum InputMedia { Photo(InputMediaPhoto), Video(InputMediaVideo), diff --git a/src/types/input_message_content.rs b/src/types/input_message_content.rs index 633beb9c..a470080e 100644 --- a/src/types/input_message_content.rs +++ b/src/types/input_message_content.rs @@ -8,6 +8,7 @@ use crate::types::ParseMode; /// [The official docs](https://core.telegram.org/bots/api#inputmessagecontent). #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(untagged)] +#[non_exhaustive] pub enum InputMessageContent { Text(InputMessageContentText), Location(InputMessageContentLocation), @@ -18,6 +19,7 @@ pub enum InputMessageContent { /// inline query. #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct InputMessageContentText { /// Text of the message to be sent, 1-4096 characters. pub message_text: String, @@ -38,6 +40,7 @@ pub struct InputMessageContentText { /// inline query. #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct InputMessageContentLocation { /// Latitude of the location in degrees. pub latitude: f64, @@ -54,7 +57,7 @@ pub struct InputMessageContentLocation { /// an inline query. #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] - +#[non_exhaustive] pub struct InputMessageContentVenue { /// Latitude of the venue in degrees. pub latitude: f64, @@ -81,6 +84,7 @@ pub struct InputMessageContentVenue { /// an inline query. #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct InputMessageContentContact { /// Contact's phone number. pub phone_number: String, diff --git a/src/types/invoice.rs b/src/types/invoice.rs index b9f2f5b6..c4065e57 100644 --- a/src/types/invoice.rs +++ b/src/types/invoice.rs @@ -4,6 +4,7 @@ use serde::{Deserialize, Serialize}; /// /// [The official docs](https://core.telegram.org/bots/api#invoice). #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct Invoice { /// Product name. pub title: String, diff --git a/src/types/keyboard_button.rs b/src/types/keyboard_button.rs index 4c964bdd..e8531126 100644 --- a/src/types/keyboard_button.rs +++ b/src/types/keyboard_button.rs @@ -10,6 +10,7 @@ use crate::types::{KeyboardButtonPollType, True}; /// [The official docs](https://core.telegram.org/bots/api#keyboardbutton). #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct KeyboardButton { /// Text of the button. If none of the optional fields are used, it will /// be sent as a message when the button is pressed. @@ -45,6 +46,7 @@ impl KeyboardButton { // Serialize + Deserialize are implemented by hand #[derive(Clone, Debug, Eq, Hash, PartialEq)] +#[non_exhaustive] pub enum ButtonRequest { Location, Contact, @@ -54,6 +56,7 @@ pub enum ButtonRequest { /// Helper struct for (de)serializing [`ButtonRequest`](ButtonRequest) #[serde_with_macros::skip_serializing_none] #[derive(Serialize, Deserialize)] +#[non_exhaustive] struct RawRequest { /// If `true`, the user's phone number will be sent as a contact /// when the button is pressed. Available in private chats only. diff --git a/src/types/keyboard_button_poll_type.rs b/src/types/keyboard_button_poll_type.rs index b1880f2c..6256aa85 100644 --- a/src/types/keyboard_button_poll_type.rs +++ b/src/types/keyboard_button_poll_type.rs @@ -1,6 +1,7 @@ use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct KeyboardButtonPollType { poll_type: String, } diff --git a/src/types/label_price.rs b/src/types/label_price.rs index da2fa5f2..0e003443 100644 --- a/src/types/label_price.rs +++ b/src/types/label_price.rs @@ -4,6 +4,7 @@ use serde::{Deserialize, Serialize}; /// /// [The official docs](https://core.telegram.org/bots/api#labeledprice). #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct LabeledPrice { /// Portion label. pub label: String, diff --git a/src/types/location.rs b/src/types/location.rs index c624d638..b786847a 100644 --- a/src/types/location.rs +++ b/src/types/location.rs @@ -2,6 +2,7 @@ use serde::{Deserialize, Serialize}; /// This object represents a point on the map. #[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct Location { /// Longitude as defined by sender. pub longitude: f64, diff --git a/src/types/login_url.rs b/src/types/login_url.rs index 2e2b7f94..3ffb5c8f 100644 --- a/src/types/login_url.rs +++ b/src/types/login_url.rs @@ -14,6 +14,7 @@ use serde::{Deserialize, Serialize}; /// [Telegram Login Widget]: https://core.telegram.org/widgets/login #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct LoginUrl { pub url: String, pub forward_text: Option, diff --git a/src/types/mask_position.rs b/src/types/mask_position.rs index f5758335..bef03062 100644 --- a/src/types/mask_position.rs +++ b/src/types/mask_position.rs @@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize}; /// /// [The official docs](https://core.telegram.org/bots/api#maskposition). #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct MaskPosition { /// The part of the face relative to which the mask should be placed. One /// of `forehead`, `eyes`, `mouth`, or `chin`. diff --git a/src/types/message.rs b/src/types/message.rs index bed3ef8d..41bcdcf5 100644 --- a/src/types/message.rs +++ b/src/types/message.rs @@ -13,6 +13,7 @@ use crate::types::{ /// /// [The official docs](https://core.telegram.org/bots/api#message). #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct Message { /// Unique message identifier inside this chat. #[serde(rename = "message_id")] @@ -30,6 +31,7 @@ pub struct Message { #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(untagged)] +#[non_exhaustive] pub enum MessageKind { Common(MessageCommon), NewChatMembers(MessageNewChatMembers), @@ -50,6 +52,7 @@ pub enum MessageKind { #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct MessageCommon { /// Sender, empty for messages sent to channels. pub from: Option, @@ -69,6 +72,7 @@ pub struct MessageCommon { } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct MessageNewChatMembers { /// New members that were added to the group or supergroup and /// information about them (the bot itself may be one of these @@ -77,6 +81,7 @@ pub struct MessageNewChatMembers { } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct MessageLeftChatMember { /// A member was removed from the group, information about them (this /// member may be the bot itself). @@ -84,30 +89,35 @@ pub struct MessageLeftChatMember { } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct MessageNewChatTitle { /// A chat title was changed to this value. pub new_chat_title: String, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct MessageNewChatPhoto { /// A chat photo was change to this value. pub new_chat_photo: Vec, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct MessageDeleteChatPhoto { /// Service message: the chat photo was deleted. pub delete_chat_photo: True, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct MessageGroupChatCreated { /// Service message: the group has been created. pub group_chat_created: True, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct MessageSupergroupChatCreated { /// Service message: the supergroup has been created. This field can‘t /// be received in a message coming through updates, because bot can’t @@ -118,6 +128,7 @@ pub struct MessageSupergroupChatCreated { } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct MessageChannelChatCreated { /// Service message: the channel has been created. This field can‘t be /// received in a message coming through updates, because bot can’t be @@ -128,6 +139,7 @@ pub struct MessageChannelChatCreated { } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct MessageMigrate { /// The group has been migrated to a supergroup with the specified /// identifier. This number may be greater than 32 bits and some @@ -147,6 +159,7 @@ pub struct MessageMigrate { } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct MessagePinned { /// Specified message was pinned. Note that the Message object in this /// field will not contain further `reply_to_message` fields even if it @@ -156,6 +169,7 @@ pub struct MessagePinned { } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct MessageInvoice { /// Message is an invoice for a [payment], information about the /// invoice. [More about payments »]. @@ -166,6 +180,7 @@ pub struct MessageInvoice { } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct MessageSuccessfulPayment { /// Message is a service message about a successful payment, /// information about the payment. [More about payments »]. @@ -175,6 +190,7 @@ pub struct MessageSuccessfulPayment { } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct MessageConnectedWebsite { /// The domain name of the website on which the user has logged in. /// [More about Telegram Login »]. @@ -184,12 +200,14 @@ pub struct MessageConnectedWebsite { } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct MessagePassportData { /// Telegram Passport data. pub passport_data: PassportData, } #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub enum ForwardedFrom { #[serde(rename = "forward_from")] User(User), @@ -199,6 +217,7 @@ pub enum ForwardedFrom { #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(untagged)] +#[non_exhaustive] pub enum ForwardKind { Channel(ForwardChannel), NonChannel(ForwardNonChannel), @@ -206,6 +225,7 @@ pub enum ForwardKind { } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct ForwardChannel { #[serde(rename = "forward_date")] pub date: i32, @@ -221,6 +241,7 @@ pub struct ForwardChannel { } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct ForwardNonChannel { #[serde(rename = "forward_date")] pub date: i32, @@ -230,12 +251,14 @@ pub struct ForwardNonChannel { } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct ForwardOrigin { pub reply_to_message: Option>, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(untagged)] +#[non_exhaustive] pub enum MediaKind { Animation(MediaAnimation), Audio(MediaAudio), @@ -254,6 +277,7 @@ pub enum MediaKind { } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct MediaAnimation { /// Message is an animation, information about the animation. For /// backward compatibility, when this field is set, the document field @@ -276,6 +300,7 @@ pub struct MediaAnimation { #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct MediaAudio { /// Message is an audio file, information about the file. pub audio: Audio, @@ -290,6 +315,7 @@ pub struct MediaAudio { } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct MediaContact { /// Message is a shared contact, information about the contact. contact: Contact, @@ -297,6 +323,7 @@ pub struct MediaContact { #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct MediaDocument { /// Message is a general file, information about the file. pub document: Document, @@ -311,6 +338,7 @@ pub struct MediaDocument { } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct MediaGame { /// Message is a game, information about the game. [More /// about games »]. @@ -320,6 +348,7 @@ pub struct MediaGame { } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct MediaLocation { /// Message is a shared location, information about the location. pub location: Location, @@ -327,6 +356,7 @@ pub struct MediaLocation { #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct MediaPhoto { /// Message is a photo, available sizes of the photo. pub photo: Vec, @@ -345,18 +375,21 @@ pub struct MediaPhoto { } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct MediaPoll { /// Message is a native poll, information about the poll. pub poll: Poll, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct MediaSticker { /// Message is a sticker, information about the sticker. pub sticker: Sticker, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct MediaText { /// For text messages, the actual UTF-8 text of the message, 0-4096 /// characters. @@ -370,6 +403,7 @@ pub struct MediaText { #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct MediaVideo { /// Message is a video, information about the video. pub video: Video, @@ -388,6 +422,7 @@ pub struct MediaVideo { } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct MediaVideoNote { /// Message is a [video note], information about the video message. /// @@ -397,6 +432,7 @@ pub struct MediaVideoNote { #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct MediaVoice { /// Message is a voice message, information about the file. pub voice: Voice, @@ -411,6 +447,7 @@ pub struct MediaVoice { } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct MediaVenue { /// Message is a venue, information about the venue. pub venue: Venue, diff --git a/src/types/message_entity.rs b/src/types/message_entity.rs index 7d8458fd..d44de1cb 100644 --- a/src/types/message_entity.rs +++ b/src/types/message_entity.rs @@ -8,6 +8,7 @@ use crate::types::{Message, User}; /// /// [The official docs](https://core.telegram.org/bots/api#messageentity). #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct MessageEntity { #[serde(flatten)] pub kind: MessageEntityKind, @@ -22,6 +23,7 @@ pub struct MessageEntity { #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] #[serde(tag = "type")] +#[non_exhaustive] pub enum MessageEntityKind { Mention, Hashtag, diff --git a/src/types/order_info.rs b/src/types/order_info.rs index e5b35bbc..72d0c10a 100644 --- a/src/types/order_info.rs +++ b/src/types/order_info.rs @@ -6,6 +6,7 @@ use crate::types::ShippingAddress; /// /// [The official docs](https://core.telegram.org/bots/api#orderinfo). #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct OrderInfo { /// User's name. pub name: String, diff --git a/src/types/parse_mode.rs b/src/types/parse_mode.rs index 989b2f24..44a0ecff 100644 --- a/src/types/parse_mode.rs +++ b/src/types/parse_mode.rs @@ -126,6 +126,7 @@ use serde::{Deserialize, Serialize}; /// [`HTML`]: ParseMode::HTML /// [`Markdown`]: ParseMode::Markdown #[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub enum ParseMode { MarkdownV2, HTML, diff --git a/src/types/passport_data.rs b/src/types/passport_data.rs index 5e548f57..6d1f760a 100644 --- a/src/types/passport_data.rs +++ b/src/types/passport_data.rs @@ -7,6 +7,7 @@ use super::{EncryptedCredentials, EncryptedPassportElement}; /// /// [The official docs](https://core.telegram.org/bots/api#passportdata). #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct PassportData { /// Array with information about documents and other Telegram Passport /// elements that was shared with the bot. diff --git a/src/types/passport_element_error.rs b/src/types/passport_element_error.rs index ed453eb1..09034b60 100644 --- a/src/types/passport_element_error.rs +++ b/src/types/passport_element_error.rs @@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize}; /// /// [The official docs](https://core.telegram.org/bots/api#passportelementerror). #[derive(Clone, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct PassportElementError { /// Error message. message: String, @@ -16,6 +17,7 @@ pub struct PassportElementError { // TODO: use different types? #[serde(tag = "source")] #[derive(Clone, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub enum PassportElementErrorKind { #[serde(rename = "data")] DataField(PassportElementErrorDataField), @@ -52,6 +54,7 @@ pub enum PassportElementErrorKind { /// /// [The official docs](https://core.telegram.org/bots/api#passportelementerrordatafield). #[derive(Clone, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct PassportElementErrorDataField { /// The section of the user's Telegram Passport which has the error. pub r#type: PassportElementErrorDataFieldType, @@ -70,6 +73,7 @@ pub struct PassportElementErrorDataField { /// /// [The official docs](https://core.telegram.org/bots/api#passportelementerrorfrontside). #[derive(Clone, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct PassportElementErrorFrontSide { /// The section of the user's Telegram Passport which has the issue. pub r#type: PassportElementErrorFrontSideType, @@ -86,6 +90,7 @@ pub struct PassportElementErrorFrontSide { /// /// [The official docs](https://core.telegram.org/bots/api#passportelementerrorreverseside). #[derive(Clone, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct PassportElementErrorReverseSide { /// The section of the user's Telegram Passport which has the issue. pub r#type: PassportElementErrorReverseSideType, @@ -101,6 +106,7 @@ pub struct PassportElementErrorReverseSide { /// /// [The official docs](https://core.telegram.org/bots/api#passportelementerrorselfie). #[derive(Clone, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct PassportElementErrorSelfie { /// The section of the user's Telegram Passport which has the issue. pub r#type: PassportElementErrorSelfieType, @@ -116,6 +122,7 @@ pub struct PassportElementErrorSelfie { /// /// [The official docs](https://core.telegram.org/bots/api#passportelementerrorfile). #[derive(Clone, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct PassportElementErrorFile { /// The section of the user's Telegram Passport which has the issue. pub r#type: PassportElementErrorFileType, @@ -131,6 +138,7 @@ pub struct PassportElementErrorFile { /// /// [The official docs](https://core.telegram.org/bots/api#passportelementerrorfiles). #[derive(Clone, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct PassportElementErrorFiles { /// The section of the user's Telegram Passport which has the issue. pub r#type: PassportElementErrorFilesType, @@ -146,6 +154,7 @@ pub struct PassportElementErrorFiles { /// /// [The official docs](https://core.telegram.org/bots/api#passportelementerrortranslationfile). #[derive(Clone, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct PassportElementErrorTranslationFile { /// Type of element of the user's Telegram Passport which has the /// issue. @@ -162,6 +171,7 @@ pub struct PassportElementErrorTranslationFile { /// /// [The official docs](https://core.telegram.org/bots/api#passportelementerrortranslationfiles). #[derive(Clone, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct PassportElementErrorTranslationFiles { /// Type of element of the user's Telegram Passport which has the issue pub r#type: PassportElementErrorTranslationFilesType, @@ -176,6 +186,7 @@ pub struct PassportElementErrorTranslationFiles { /// /// [The official docs](https://core.telegram.org/bots/api#passportelementerrorunspecified). #[derive(Clone, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct PassportElementErrorUnspecified { /// Type of element of the user's Telegram Passport which has the /// issue. @@ -187,6 +198,7 @@ pub struct PassportElementErrorUnspecified { #[derive(Clone, Copy, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] +#[non_exhaustive] pub enum PassportElementErrorDataFieldType { PersonalDetails, Passport, @@ -198,6 +210,7 @@ pub enum PassportElementErrorDataFieldType { #[derive(Clone, Copy, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] +#[non_exhaustive] pub enum PassportElementErrorFrontSideType { Passport, DriverLicense, @@ -207,6 +220,7 @@ pub enum PassportElementErrorFrontSideType { #[derive(Clone, Copy, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] +#[non_exhaustive] pub enum PassportElementErrorReverseSideType { DriverLicense, IdentityCard, @@ -214,6 +228,7 @@ pub enum PassportElementErrorReverseSideType { #[derive(Clone, Copy, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] +#[non_exhaustive] pub enum PassportElementErrorSelfieType { Passport, DriverLicense, @@ -223,6 +238,7 @@ pub enum PassportElementErrorSelfieType { #[derive(Clone, Copy, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] +#[non_exhaustive] pub enum PassportElementErrorFileType { UtilityBill, BankStatement, @@ -233,6 +249,7 @@ pub enum PassportElementErrorFileType { #[derive(Clone, Copy, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] +#[non_exhaustive] pub enum PassportElementErrorFilesType { UtilityBill, BankStatement, @@ -243,6 +260,7 @@ pub enum PassportElementErrorFilesType { #[derive(Clone, Copy, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] +#[non_exhaustive] pub enum PassportElementErrorTranslationFileType { Passport, DriverLicense, @@ -257,6 +275,7 @@ pub enum PassportElementErrorTranslationFileType { #[derive(Clone, Copy, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] +#[non_exhaustive] pub enum PassportElementErrorTranslationFilesType { Passport, DriverLicense, @@ -271,6 +290,7 @@ pub enum PassportElementErrorTranslationFilesType { #[derive(Clone, Copy, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] +#[non_exhaustive] pub enum PassportElementErrorUnspecifiedType { DataField, FrontSide, diff --git a/src/types/passport_file.rs b/src/types/passport_file.rs index 18f1a5d4..2762a0c0 100644 --- a/src/types/passport_file.rs +++ b/src/types/passport_file.rs @@ -7,6 +7,7 @@ use serde::{Deserialize, Serialize}; /// /// [The official docs](https://core.telegram.org/bots/api#passportfile). #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct PassportFile { /// Identifier for this file. pub file_id: String, diff --git a/src/types/photo_size.rs b/src/types/photo_size.rs index 44ddfe32..5efda500 100644 --- a/src/types/photo_size.rs +++ b/src/types/photo_size.rs @@ -6,6 +6,7 @@ use serde::{Deserialize, Serialize}; /// [sticker]: crate::types::Sticker #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct PhotoSize { /// Identifier for this file. pub file_id: String, diff --git a/src/types/poll.rs b/src/types/poll.rs index 085a4c19..8084367a 100644 --- a/src/types/poll.rs +++ b/src/types/poll.rs @@ -6,6 +6,7 @@ use serde::{Deserialize, Serialize}; /// [The official docs](https://core.telegram.org/bots/api#poll). #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct Poll { /// Unique poll identifier. pub id: String, @@ -42,6 +43,7 @@ pub struct Poll { /// /// [The official docs](https://core.telegram.org/bots/api#polloption). #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct PollOption { /// Option text, 1-100 characters. pub text: String, diff --git a/src/types/poll_answer.rs b/src/types/poll_answer.rs index b8f26968..2d16cb2b 100644 --- a/src/types/poll_answer.rs +++ b/src/types/poll_answer.rs @@ -2,6 +2,7 @@ use crate::types::User; use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct PollAnswer { /// Unique poll identifier. pub poll_id: String, diff --git a/src/types/poll_type.rs b/src/types/poll_type.rs index 61b8acd9..0243f7c1 100644 --- a/src/types/poll_type.rs +++ b/src/types/poll_type.rs @@ -2,6 +2,7 @@ use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "lowercase")] +#[non_exhaustive] pub enum PollType { Quiz, Regular, diff --git a/src/types/pre_checkout_query.rs b/src/types/pre_checkout_query.rs index 172e5e8f..78489d13 100644 --- a/src/types/pre_checkout_query.rs +++ b/src/types/pre_checkout_query.rs @@ -7,6 +7,7 @@ use crate::types::{Currency, OrderInfo, User}; /// [The official docs](https://core.telegram.org/bots/api#precheckoutquery). #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct PreCheckoutQuery { /// Unique query identifier. pub id: String, diff --git a/src/types/reply_keyboard_markup.rs b/src/types/reply_keyboard_markup.rs index aea63b73..8228b36d 100644 --- a/src/types/reply_keyboard_markup.rs +++ b/src/types/reply_keyboard_markup.rs @@ -11,6 +11,7 @@ use crate::types::KeyboardButton; /// [Introduction to bots]: https://core.telegram.org/bots#keyboards #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, Default)] +#[non_exhaustive] pub struct ReplyKeyboardMarkup { /// Array of button rows, each represented by an Array of /// [`KeyboardButton`] objects diff --git a/src/types/reply_keyboard_remove.rs b/src/types/reply_keyboard_remove.rs index 35d55db7..ed6fdc7f 100644 --- a/src/types/reply_keyboard_remove.rs +++ b/src/types/reply_keyboard_remove.rs @@ -14,6 +14,7 @@ use crate::types::True; /// [`ReplyKeyboardMarkup`]: crate::types::ReplyKeyboardMarkup #[serde_with_macros::skip_serializing_none] #[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct ReplyKeyboardRemove { /// Requests clients to remove the custom keyboard (user will not be able /// to summon this keyboard; if you want to hide the keyboard from sight diff --git a/src/types/reply_markup.rs b/src/types/reply_markup.rs index 5f0afbbe..4bddc56c 100644 --- a/src/types/reply_markup.rs +++ b/src/types/reply_markup.rs @@ -5,6 +5,7 @@ use crate::types::{ForceReply, InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyK #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, From)] #[serde(untagged)] +#[non_exhaustive] pub enum ReplyMarkup { InlineKeyboardMarkup(InlineKeyboardMarkup), ReplyKeyboardMarkup(ReplyKeyboardMarkup), diff --git a/src/types/response_parameters.rs b/src/types/response_parameters.rs index c69ce9e0..2f0fb43f 100644 --- a/src/types/response_parameters.rs +++ b/src/types/response_parameters.rs @@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize}; /// [The official docs](https://core.telegram.org/bots/api#responseparameters). #[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] +#[non_exhaustive] pub enum ResponseParameters { /// The group has been migrated to a supergroup with the specified /// identifier. This number may be greater than 32 bits and some diff --git a/src/types/send_invoice.rs b/src/types/send_invoice.rs index 3e0bbd40..e5ba0414 100644 --- a/src/types/send_invoice.rs +++ b/src/types/send_invoice.rs @@ -5,6 +5,7 @@ use crate::types::{ChatId, InlineKeyboardMarkup, LabeledPrice}; // TODO: missing docs #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct SendInvoice { pub chat_id: ChatId, pub title: String, diff --git a/src/types/shipping_address.rs b/src/types/shipping_address.rs index 478ad714..5e7e9fa0 100644 --- a/src/types/shipping_address.rs +++ b/src/types/shipping_address.rs @@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize}; /// /// [The official docs](https://core.telegram.org/bots/api#shippingaddress). #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct ShippingAddress { /// ISO 3166-1 alpha-2 country code. pub country_code: CountryCode, diff --git a/src/types/shipping_option.rs b/src/types/shipping_option.rs index a915522b..faf4323a 100644 --- a/src/types/shipping_option.rs +++ b/src/types/shipping_option.rs @@ -6,6 +6,7 @@ use crate::types::LabeledPrice; /// /// [The official docs](https://core.telegram.org/bots/api#shippingoption). #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct ShippingOption { /// Shipping option identifier. pub id: String, diff --git a/src/types/shipping_query.rs b/src/types/shipping_query.rs index f8df55d4..b0e7620a 100644 --- a/src/types/shipping_query.rs +++ b/src/types/shipping_query.rs @@ -6,6 +6,7 @@ use crate::types::{ShippingAddress, User}; /// /// [The official docs](https://core.telegram.org/bots/api#shippingquery). #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct ShippingQuery { /// Unique query identifier. pub id: String, diff --git a/src/types/sticker.rs b/src/types/sticker.rs index 235f774d..0548da42 100644 --- a/src/types/sticker.rs +++ b/src/types/sticker.rs @@ -7,6 +7,7 @@ use crate::types::{MaskPosition, PhotoSize}; /// [The official docs](https://core.telegram.org/bots/api#sticker). #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct Sticker { /// Identifier for this file. pub file_id: String, diff --git a/src/types/sticker_set.rs b/src/types/sticker_set.rs index f57dec65..db3eabf7 100644 --- a/src/types/sticker_set.rs +++ b/src/types/sticker_set.rs @@ -6,6 +6,7 @@ use crate::types::Sticker; /// /// [The official docs](https://core.telegram.org/bots/api#stickerset). #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct StickerSet { /// Sticker set name. pub name: String, diff --git a/src/types/successful_payment.rs b/src/types/successful_payment.rs index d38a36b5..68198920 100644 --- a/src/types/successful_payment.rs +++ b/src/types/successful_payment.rs @@ -7,6 +7,7 @@ use crate::types::{Currency, OrderInfo}; /// [The official docs](https://core.telegram.org/bots/api#successfulpayment). #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct SuccessfulPayment { /// Three-letter ISO 4217 [currency] code. /// diff --git a/src/types/update.rs b/src/types/update.rs index e992c216..7eacf00c 100644 --- a/src/types/update.rs +++ b/src/types/update.rs @@ -14,6 +14,7 @@ use serde_json::Value; /// /// [object]: https://core.telegram.org/bots/api#available-types #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct Update { /// The update‘s unique identifier. Update identifiers start from a certain /// positive number and increase sequentially. This ID becomes especially @@ -54,6 +55,7 @@ impl Update { #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] +#[non_exhaustive] pub enum UpdateKind { /// New incoming message of any kind — text, photo, sticker, etc. Message(Message), diff --git a/src/types/user.rs b/src/types/user.rs index 55d2eb48..315bc08f 100644 --- a/src/types/user.rs +++ b/src/types/user.rs @@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize}; /// [The official docs](https://core.telegram.org/bots/api#user). #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct User { /// Unique identifier for this user or bot. pub id: i32, @@ -48,6 +49,7 @@ impl User { /// /// [`Bot::get_me`]: crate::Bot::get_me #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct Me { #[serde(flatten)] pub user: User, diff --git a/src/types/user_profile_photos.rs b/src/types/user_profile_photos.rs index ac0a9b5d..21d62bd6 100644 --- a/src/types/user_profile_photos.rs +++ b/src/types/user_profile_photos.rs @@ -6,6 +6,7 @@ use crate::types::PhotoSize; /// /// [The official docs](https://core.telegram.org/bots/api#userprofilephotos). #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct UserProfilePhotos { /// Total number of profile pictures the target user has. pub total_count: u32, diff --git a/src/types/venue.rs b/src/types/venue.rs index afb0cc90..428dc007 100644 --- a/src/types/venue.rs +++ b/src/types/venue.rs @@ -5,6 +5,7 @@ use crate::types::Location; /// This object represents a venue. #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct Venue { /// Venue location. pub location: Location, diff --git a/src/types/video.rs b/src/types/video.rs index e87248f8..c4f0a800 100644 --- a/src/types/video.rs +++ b/src/types/video.rs @@ -7,6 +7,7 @@ use crate::types::{MimeWrapper, PhotoSize}; /// [The official docs](https://core.telegram.org/bots/api#video). #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct Video { /// Identifier for this file. pub file_id: String, diff --git a/src/types/video_note.rs b/src/types/video_note.rs index 9a751e20..399ebc72 100644 --- a/src/types/video_note.rs +++ b/src/types/video_note.rs @@ -11,6 +11,7 @@ use crate::types::PhotoSize; /// [v4.0]: https://telegram.org/blog/video-messages-and-telescope #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct VideoNote { /// Identifier for this file. pub file_id: String, diff --git a/src/types/voice.rs b/src/types/voice.rs index 464a5eb5..914f5648 100644 --- a/src/types/voice.rs +++ b/src/types/voice.rs @@ -6,6 +6,7 @@ use serde::{Deserialize, Serialize}; /// [The official docs](https://core.telegram.org/bots/api#voice). #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct Voice { /// Identifier for this file. pub file_id: String, diff --git a/src/types/webhook_info.rs b/src/types/webhook_info.rs index e7658381..cb2293ef 100644 --- a/src/types/webhook_info.rs +++ b/src/types/webhook_info.rs @@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize}; /// [The official docs](https://core.telegram.org/bots/api#webhookinfo). #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] pub struct WebhookInfo { /// Webhook URL, may be empty if webhook is not set up. pub url: String,