[][src]Enum tbot::types::keyboard::inline::ButtonKind

#[non_exhaustive]
#[must_use]
pub enum ButtonKind<'a> {
    Url(&'a str),
    LoginUrl(LoginUrl<'a>),
    CallbackData(&'a str),
    SwitchInlineQuery(&'a str),
    SwitchInlineQueryCurrentChat(&'a str),
    CallbackGame(Game),
    Pay(bool),
}

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(&'a str)

Represents a URL button.

LoginUrl(LoginUrl<'a>)

Represents a login button.

CallbackData(&'a str)

Represents callback data.

SwitchInlineQuery(&'a str)

Represents query inserted when switched to inline.

SwitchInlineQueryCurrentChat(&'a str)

Represents query inserted when switched to inline in the curent chat.

CallbackGame(Game)

Represent a description of the game to be laucnhed.

Pay(bool)

If true, a pay button is sent.

Methods

impl<'a> ButtonKind<'a>[src]

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

Returns true if self is of variant Url.

pub fn expect_url(self) -> &'a str 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<&'a str>[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<'a> 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<'a>>[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) -> &'a str 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<&'a str>[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) -> &'a str 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<&'a str>[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) -> &'a str 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<&'a str>[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.

pub fn expect_pay(self) -> bool where
    Self: Debug
[src]

Unwraps the value, yielding the content of Pay.

Panics

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

pub fn pay(self) -> Option<bool>[src]

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

Trait Implementations

impl<'a> Clone for ButtonKind<'a>[src]

impl<'a> Copy for ButtonKind<'a>[src]

impl<'a> Debug for ButtonKind<'a>[src]

impl<'a> Eq for ButtonKind<'a>[src]

impl<'a> Hash for ButtonKind<'a>[src]

impl<'a> PartialEq<ButtonKind<'a>> for ButtonKind<'a>[src]

impl<'a> StructuralEq for ButtonKind<'a>[src]

impl<'a> StructuralPartialEq for ButtonKind<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for ButtonKind<'a>

impl<'a> Send for ButtonKind<'a>

impl<'a> Sync for ButtonKind<'a>

impl<'a> Unpin for ButtonKind<'a>

impl<'a> UnwindSafe for ButtonKind<'a>

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<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

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

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

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.