Enum tbot::types::keyboard::inline::button::Kind[][src]

#[non_exhaustive]
#[must_use]
pub enum Kind {
    Url(String),
    LoginUrl(LoginUrl),
    CallbackData(String),
    SwitchInlineQuery(String),
    SwitchInlineQueryCurrentChat(String),
    CallbackGame(Game),
    Pay,
}

Represents different types an inline button can be.

Complete descriptions can be found in Bots API docs.

Variants (Non-exhaustive)

Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
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

impl Kind[src]

pub fn is_url(&self) -> bool[src]

Returns true if self is of variant Url.

pub fn expect_url(self) -> String where
    Self: Debug
[src]

Unwraps the value, yielding the content of Url.

Panics

Panics if the value is not Url, with a panic message including the content of self.

pub fn url(self) -> Option<String>[src]

Returns Some if self is of variant Url, and None otherwise.

pub fn is_login_url(&self) -> bool[src]

Returns true if self is of variant LoginUrl.

pub fn expect_login_url(self) -> LoginUrl where
    Self: Debug
[src]

Unwraps the value, yielding the content of LoginUrl.

Panics

Panics if the value is not LoginUrl, with a panic message including the content of self.

pub fn login_url(self) -> Option<LoginUrl>[src]

Returns Some if self is of variant LoginUrl, and None otherwise.

pub fn is_callback_data(&self) -> bool[src]

Returns true if self is of variant CallbackData.

pub fn expect_callback_data(self) -> String where
    Self: Debug
[src]

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.

pub fn callback_data(self) -> Option<String>[src]

Returns Some if self is of variant CallbackData, and None otherwise.

pub fn is_switch_inline_query(&self) -> bool[src]

Returns true if self is of variant SwitchInlineQuery.

pub fn expect_switch_inline_query(self) -> String where
    Self: Debug
[src]

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.

pub fn switch_inline_query(self) -> Option<String>[src]

Returns Some if self is of variant SwitchInlineQuery, and None otherwise.

pub fn is_switch_inline_query_current_chat(&self) -> bool[src]

Returns true if self is of variant SwitchInlineQueryCurrentChat.

pub fn expect_switch_inline_query_current_chat(self) -> String where
    Self: Debug
[src]

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.

pub fn switch_inline_query_current_chat(self) -> Option<String>[src]

Returns Some if self is of variant SwitchInlineQueryCurrentChat, and None otherwise.

pub fn is_callback_game(&self) -> bool[src]

Returns true if self is of variant CallbackGame.

pub fn expect_callback_game(self) -> Game where
    Self: Debug
[src]

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.

pub fn callback_game(self) -> Option<Game>[src]

Returns Some if self is of variant CallbackGame, and None otherwise.

pub fn is_pay(&self) -> bool[src]

Returns true if self is of variant Pay.

impl Kind[src]

pub fn with_url(url: impl Into<String>) -> Self[src]

Constructs a ButtonKind::Url.

pub const fn with_login_url(login_url: LoginUrl) -> Self[src]

Constructs a ButtonKind::LoginUrl.

pub fn with_callback_data(data: impl Into<String>) -> Self[src]

Constructs a ButtonKind::CallbackData.

pub fn with_switch_inline_query(query: impl Into<String>) -> Self[src]

Constructs a ButtonKind::SwitchInlineQuery.

pub fn with_switch_inline_query_current_chat(query: impl Into<String>) -> Self[src]

Constructs a ButtonKind::SwitchInlineQueryCurrentChat.

pub const fn with_callback_game(game: Game) -> Self[src]

Constructs a ButtonKind::CallbackGame.

pub const fn with_pay() -> Self[src]

Constructs a ButtonKind::Pay.

Trait Implementations

impl Clone for Kind[src]

impl Debug for Kind[src]

impl Hash for Kind[src]

impl PartialEq<Kind> for Kind[src]

impl Eq for Kind[src]

impl StructuralEq for Kind[src]

impl StructuralPartialEq for Kind[src]

Auto Trait Implementations

impl RefUnwindSafe for Kind

impl Send for Kind

impl Sync for Kind

impl Unpin for Kind

impl UnwindSafe for Kind

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.