Skip to content

Commit

Permalink
Add #[skip_serializing_none] for struct with Option
Browse files Browse the repository at this point in the history
  • Loading branch information
Desiders committed Feb 27, 2024
1 parent 26c3b57 commit d40a31c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions telers/src/types/inline_query_results_button.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
use super::WebAppInfo;

use serde::{Deserialize, Serialize};
use serde_with::skip_serializing_none;

/// This object represents a button to be shown above inline query results. You **must** use exactly one of the optional fields.
/// # Documentation
/// <https://core.telegram.org/bots/api#inlinequeryresultsbutton>
#[skip_serializing_none]
#[derive(Debug, Clone, Hash, PartialEq, Eq, Deserialize, Serialize)]
pub struct InlineQueryResultsButton {
/// Label text on the button
Expand Down
2 changes: 2 additions & 0 deletions telers/src/types/keyboard_button_request_chat.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
use super::ChatAdministratorRights;

use serde::{Deserialize, Serialize};
use serde_with::skip_serializing_none;

/// This object defines the criteria used to request a suitable chat. The identifier of the selected chat will be shared with the bot when the corresponding button is pressed. [`More about requesting chats`](https://core.telegram.org/bots/features#chat-and-user-selection)
/// # Documentation
/// <https://core.telegram.org/bots/api#keyboardbuttonrequestchat>
#[skip_serializing_none]
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize, Serialize)]
pub struct KeyboardButtonRequestChat {
/// Signed 32-bit identifier of the request, which will be received back in the [`ChatShared`](crate::types::ChatShared) object. Must be unique within the message
Expand Down
2 changes: 2 additions & 0 deletions telers/src/types/switch_inline_query_chosen_chat.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use serde::{Deserialize, Serialize};
use serde_with::skip_serializing_none;

/// This object represents an inline button that switches the current user to inline mode in a chosen chat, with an optional default inline query.
/// # Documentation
/// <https://core.telegram.org/bots/api#switchinlinequerychosenchat>
#[skip_serializing_none]
#[derive(Debug, Default, Clone, Hash, PartialEq, Eq, Deserialize, Serialize)]
pub struct SwitchInlineQueryChosenChat {
/// The default inline query to be inserted in the input field. If left empty, only the bot's username will be inserted
Expand Down

0 comments on commit d40a31c

Please sign in to comment.