#[non_exhaustive]
pub enum Kind {
Url(String),
LoginUrl(LoginUrl),
CallbackData(String),
SwitchInlineQuery(String),
SwitchInlineQueryCurrentChat(String),
CallbackGame(Game),
Pay,
}
Expand description
Represents different types an inline button can be.
Complete descriptions can be found in Bots API docs.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Url(String)
Represents a URL button.
LoginUrl(LoginUrl)
Represents a login button.
CallbackData(String)
Represents callback data.
SwitchInlineQuery(String)
Represents query inserted when switched to inline.
SwitchInlineQueryCurrentChat(String)
Represents query inserted when switched to inline in the curent chat.
CallbackGame(Game)
Represent a description of the game to be laucnhed.
Pay
Represents a pay button.
Implementations§
source§impl Kind
impl Kind
sourcepub fn expect_url(self) -> Stringwhere
Self: Debug,
pub fn expect_url(self) -> Stringwhere
Self: Debug,
sourcepub fn is_login_url(&self) -> bool
pub fn is_login_url(&self) -> bool
Returns true
if self
is of variant LoginUrl
.
sourcepub fn expect_login_url(self) -> LoginUrlwhere
Self: Debug,
pub fn expect_login_url(self) -> LoginUrlwhere
Self: Debug,
sourcepub fn login_url(self) -> Option<LoginUrl>
pub fn login_url(self) -> Option<LoginUrl>
Returns Some
if self
is of variant LoginUrl
, and None
otherwise.
sourcepub fn is_callback_data(&self) -> bool
pub fn is_callback_data(&self) -> bool
Returns true
if self
is of variant CallbackData
.
sourcepub fn expect_callback_data(self) -> Stringwhere
Self: Debug,
pub fn expect_callback_data(self) -> Stringwhere
Self: Debug,
Unwraps the value, yielding the content of CallbackData
.
Panics
Panics if the value is not CallbackData
, with a panic message including the content of self
.
sourcepub fn callback_data(self) -> Option<String>
pub fn callback_data(self) -> Option<String>
Returns Some
if self
is of variant CallbackData
, and None
otherwise.
sourcepub fn is_switch_inline_query(&self) -> bool
pub fn is_switch_inline_query(&self) -> bool
Returns true
if self
is of variant SwitchInlineQuery
.
sourcepub fn expect_switch_inline_query(self) -> Stringwhere
Self: Debug,
pub fn expect_switch_inline_query(self) -> Stringwhere
Self: Debug,
Unwraps the value, yielding the content of SwitchInlineQuery
.
Panics
Panics if the value is not SwitchInlineQuery
, with a panic message including the content of self
.
sourcepub fn switch_inline_query(self) -> Option<String>
pub fn switch_inline_query(self) -> Option<String>
Returns Some
if self
is of variant SwitchInlineQuery
, and None
otherwise.
sourcepub fn is_switch_inline_query_current_chat(&self) -> bool
pub fn is_switch_inline_query_current_chat(&self) -> bool
Returns true
if self
is of variant SwitchInlineQueryCurrentChat
.
sourcepub fn expect_switch_inline_query_current_chat(self) -> Stringwhere
Self: Debug,
pub fn expect_switch_inline_query_current_chat(self) -> Stringwhere
Self: Debug,
Unwraps the value, yielding the content of SwitchInlineQueryCurrentChat
.
Panics
Panics if the value is not SwitchInlineQueryCurrentChat
, with a panic message including the content of self
.
sourcepub fn switch_inline_query_current_chat(self) -> Option<String>
pub fn switch_inline_query_current_chat(self) -> Option<String>
Returns Some
if self
is of variant SwitchInlineQueryCurrentChat
, and None
otherwise.
sourcepub fn is_callback_game(&self) -> bool
pub fn is_callback_game(&self) -> bool
Returns true
if self
is of variant CallbackGame
.
sourcepub fn expect_callback_game(self) -> Gamewhere
Self: Debug,
pub fn expect_callback_game(self) -> Gamewhere
Self: Debug,
Unwraps the value, yielding the content of CallbackGame
.
Panics
Panics if the value is not CallbackGame
, with a panic message including the content of self
.
sourcepub fn callback_game(self) -> Option<Game>
pub fn callback_game(self) -> Option<Game>
Returns Some
if self
is of variant CallbackGame
, and None
otherwise.
source§impl Kind
impl Kind
sourcepub const fn with_login_url(login_url: LoginUrl) -> Self
pub const fn with_login_url(login_url: LoginUrl) -> Self
Constructs a ButtonKind::LoginUrl
.
sourcepub fn with_callback_data(data: impl Into<String>) -> Self
pub fn with_callback_data(data: impl Into<String>) -> Self
Constructs a ButtonKind::CallbackData
.
sourcepub fn with_switch_inline_query(query: impl Into<String>) -> Self
pub fn with_switch_inline_query(query: impl Into<String>) -> Self
Constructs a ButtonKind::SwitchInlineQuery
.
sourcepub fn with_switch_inline_query_current_chat(query: impl Into<String>) -> Self
pub fn with_switch_inline_query_current_chat(query: impl Into<String>) -> Self
Constructs a ButtonKind::SwitchInlineQueryCurrentChat
.
sourcepub const fn with_callback_game(game: Game) -> Self
pub const fn with_callback_game(game: Game) -> Self
Constructs a ButtonKind::CallbackGame
.