From f4507bd3d2e0b7dd4ee2c035d75afdadbd7d9ae1 Mon Sep 17 00:00:00 2001 From: Waffle Date: Fri, 19 Mar 2021 12:20:26 +0300 Subject: [PATCH] Fix: types fields privacy (make fields of some types public) The typos were found with `grep`: ```text ; grep -r -P "^ \w{2,}: .+, *$" ./src/types/* ./src/types/dice.rs: emoji: DiceEmoji, ./src/types/dice.rs: value: i32, ./src/types/keyboard_button.rs: contact: Option, ./src/types/keyboard_button.rs: location: Option, ./src/types/keyboard_button.rs: poll: Option, ./src/types/message.rs: message_auto_delete_timer_changed: MessageAutoDeleteTimerChanged, ./src/types/passport_element_error.rs: message: String, ./src/types/passport_element_error.rs: kind: PassportElementErrorKind, ./src/types/sticker_set.rs: thumb: Option, ``` `src/types/keyboard_button.rs` can be ignored since in just contains private helper structure. Fields made public: - `Dice::{emoji, value}` - `MessageMessageAutoDeleteTimerChanged::message_auto_delete_timer_changed` - `PassportElementError::{message, kind}` - `StickerSet::thumb` --- CHANGELOG.md | 10 ++++++++++ src/types/dice.rs | 4 ++-- src/types/message.rs | 2 +- src/types/passport_element_error.rs | 4 ++-- src/types/sticker_set.rs | 2 +- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d0c6b576..061c1e08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [unreleased] +### Fixed + +- Types fields privacy (make fields of some types public) ([#68][pr68]) + - `Dice::{emoji, value}` + - `MessageMessageAutoDeleteTimerChanged::message_auto_delete_timer_changed` + - `PassportElementError::{message, kind}` + - `StickerSet::thumb` + +[pr68]: https://github.com/teloxide/teloxide-core/pull/68 + ## [0.2.0] - 2020-03-16 ### Changed diff --git a/src/types/dice.rs b/src/types/dice.rs index 404abd8e..67f69bbb 100644 --- a/src/types/dice.rs +++ b/src/types/dice.rs @@ -7,7 +7,7 @@ use crate::types::DiceEmoji; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct Dice { /// Emoji on which the dice throw animation is based. - emoji: DiceEmoji, + pub emoji: DiceEmoji, /// Value of the dice. /// @@ -17,5 +17,5 @@ pub struct Dice { /// [`DiceEmoji::Dice`]: crate::types::DiceEmoji::Dice /// [`DiceEmoji::Darts`]:crate::types::DiceEmoji::Darts /// [`DiceEmoji::Basketball`]:crate::types::DiceEmoji::Basketball - value: i32, + pub value: i32, } diff --git a/src/types/message.rs b/src/types/message.rs index c9b8b2a4..0159c705 100644 --- a/src/types/message.rs +++ b/src/types/message.rs @@ -151,7 +151,7 @@ pub struct MessageChannelChatCreated { #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct MessageMessageAutoDeleteTimerChanged { /// Service message: auto-delete timer settings changed in the chat. - message_auto_delete_timer_changed: MessageAutoDeleteTimerChanged, + pub message_auto_delete_timer_changed: MessageAutoDeleteTimerChanged, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] diff --git a/src/types/passport_element_error.rs b/src/types/passport_element_error.rs index dbada303..dd594ba7 100644 --- a/src/types/passport_element_error.rs +++ b/src/types/passport_element_error.rs @@ -7,10 +7,10 @@ use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)] pub struct PassportElementError { /// Error message. - message: String, + pub message: String, #[serde(flatten)] - kind: PassportElementErrorKind, + pub kind: PassportElementErrorKind, } impl PassportElementError { diff --git a/src/types/sticker_set.rs b/src/types/sticker_set.rs index 9fea1621..5f501d60 100644 --- a/src/types/sticker_set.rs +++ b/src/types/sticker_set.rs @@ -25,5 +25,5 @@ pub struct StickerSet { pub stickers: Vec, /// Sticker set thumbnail in the .WEBP or .TGS format. - thumb: Option, + pub thumb: Option, }