Change some Option<bool> fields to bool in KeyboardButtonRequestUsers

This commit is contained in:
Akshett Rai Jindal 2024-08-24 13:14:38 +05:30
parent ca5dddab54
commit 21b164a416

View file

@ -32,16 +32,16 @@ pub struct KeyboardButtonRequestUsers {
pub max_quantity: u8, pub max_quantity: u8,
/// Pass `true` to request the users' first and last names /// Pass `true` to request the users' first and last names
#[serde(default, skip_serializing_if = "Option::is_none")] #[serde(default, skip_serializing_if = "std::ops::Not::not")]
pub request_name: Option<bool>, pub request_name: bool,
/// Pass `true` to request the users' username /// Pass `true` to request the users' username
#[serde(default, skip_serializing_if = "Option::is_none")] #[serde(default, skip_serializing_if = "std::ops::Not::not")]
pub request_username: Option<bool>, pub request_username: bool,
/// Pass `true` to request the users' photos /// Pass `true` to request the users' photos
#[serde(default, skip_serializing_if = "Option::is_none")] #[serde(default, skip_serializing_if = "std::ops::Not::not")]
pub request_photo: Option<bool>, pub request_photo: bool,
} }
impl KeyboardButtonRequestUsers { impl KeyboardButtonRequestUsers {
@ -52,9 +52,9 @@ impl KeyboardButtonRequestUsers {
user_is_bot: None, user_is_bot: None,
user_is_premium: None, user_is_premium: None,
max_quantity: 1, max_quantity: 1,
request_name: None, request_name: false,
request_username: None, request_username: false,
request_photo: None, request_photo: false,
} }
} }
@ -84,21 +84,21 @@ impl KeyboardButtonRequestUsers {
/// Setter for `request_name` field /// Setter for `request_name` field
#[must_use] #[must_use]
pub fn request_name(mut self) -> Self { pub fn request_name(mut self) -> Self {
self.request_name = Some(true); self.request_name = true;
self self
} }
/// Setter for `request_username` field /// Setter for `request_username` field
#[must_use] #[must_use]
pub fn request_username(mut self) -> Self { pub fn request_username(mut self) -> Self {
self.request_username = Some(true); 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) -> Self { pub fn request_photo(mut self) -> Self {
self.request_photo = Some(true); self.request_photo = true;
self self
} }
} }