Remove unecessary serde defaults and remove params from bool setters

This commit is contained in:
Akshett Rai Jindal 2024-08-24 13:10:05 +05:30
parent 31caa3ba04
commit ca5dddab54
4 changed files with 12 additions and 19 deletions

View file

@ -15,14 +15,11 @@ pub struct ChatShared {
pub chat_id: ChatId, pub chat_id: ChatId,
/// Title of the chat, if it was requested. /// Title of the chat, if it was requested.
#[serde(default)]
pub title: Option<String>, pub title: Option<String>,
/// Username of the chat, if it was requested. /// Username of the chat, if it was requested.
#[serde(default)]
pub username: Option<String>, pub username: Option<String>,
/// Available sizes of the chat photo, if it was requested. /// Available sizes of the chat photo, if it was requested.
#[serde(default)]
pub photo: Option<Vec<PhotoSize>>, pub photo: Option<Vec<PhotoSize>>,
} }

View file

@ -130,22 +130,22 @@ impl KeyboardButtonRequestChat {
/// Setter for `request_title` field. /// Setter for `request_title` field.
#[must_use] #[must_use]
pub fn request_title(mut self, value: bool) -> Self { pub fn request_title(mut self) -> Self {
self.request_title = value; self.request_title = true;
self self
} }
/// Setter for `request_username` field. /// Setter for `request_username` field.
#[must_use] #[must_use]
pub fn request_username(mut self, value: bool) -> Self { pub fn request_username(mut self) -> Self {
self.request_username = value; self.request_username = true;
self self
} }
/// Setter for `request_photo` field. /// Setter for `request_photo` field.
#[must_use] #[must_use]
pub fn request_photo(mut self, value: bool) -> Self { pub fn request_photo(mut self) -> Self {
self.request_photo = value; self.request_photo = true;
self self
} }
} }

View file

@ -83,22 +83,22 @@ impl KeyboardButtonRequestUsers {
/// Setter for `request_name` field /// Setter for `request_name` field
#[must_use] #[must_use]
pub fn request_name(mut self, value: bool) -> Self { pub fn request_name(mut self) -> Self {
self.request_name = Some(value); self.request_name = Some(true);
self self
} }
/// Setter for `request_username` field /// Setter for `request_username` field
#[must_use] #[must_use]
pub fn request_username(mut self, value: bool) -> Self { pub fn request_username(mut self) -> Self {
self.request_username = Some(value); self.request_username = Some(true);
self self
} }
/// Setter for `request_photo` field /// Setter for `request_photo` field
#[must_use] #[must_use]
pub fn request_photo(mut self, value: bool) -> Self { pub fn request_photo(mut self) -> Self {
self.request_photo = Some(value); self.request_photo = Some(true);
self self
} }
} }

View file

@ -12,18 +12,14 @@ pub struct SharedUser {
pub user_id: UserId, pub user_id: UserId,
/// First name of the user, if it was requested by the bot /// First name of the user, if it was requested by the bot
#[serde(default)]
pub first_name: Option<String>, pub first_name: Option<String>,
/// Last name of the user, if it was requested by the bot /// Last name of the user, if it was requested by the bot
#[serde(default)]
pub last_name: Option<String>, pub last_name: Option<String>,
/// Username of the user, if it was requested by the bot /// Username of the user, if it was requested by the bot
#[serde(default)]
pub username: Option<String>, pub username: Option<String>,
/// Available sizes of the chat photo, if it was requested /// Available sizes of the chat photo, if it was requested
#[serde(default)]
pub photo: Option<Vec<PhotoSize>>, pub photo: Option<Vec<PhotoSize>>,
} }