pub struct InlineKeyboardButton { /* private fields */ }
Expand description

This object represents one button of an inline keyboard. You must use exactly one of the optional fields.

Implementations§

source§

impl InlineKeyboardButton

source§

impl InlineKeyboardButton

source

pub fn new(text: String) -> Self

source

pub fn into_tuple( self ) -> (String, Option<String>, Option<String>, Option<WebAppInfo>, Option<LoginUrl>, Option<String>, Option<String>, Option<SwitchInlineQueryChosenChat>, Option<CallbackGame>, Option<bool>)

Consumes and deconstructs this type into a tuple with one element per field. Tuple type returned is: (text, url, callback_data, web_app, login_url, switch_inline_query, switch_inline_query_current_chat, switch_inline_query_chosen_chat, callback_game, pay)

source

pub fn get_text<'a>(&'a self) -> Cow<'a, str>

Label text on the button

source

pub fn get_text_ref<'a>(&'a self) -> &'a str

Label text on the button

source

pub fn set_text<'a>(&'a mut self, text: String) -> &'a mut Self

Label text on the button

source

pub fn get_url<'a>(&'a self) -> Option<Cow<'a, str>>

Optional. HTTP or tg:// URL to be opened when the button is pressed. Links tg://user?id=<user_id> can be used to mention a user by their ID without using a username, if this is allowed by their privacy settings.

source

pub fn get_url_ref<'a>(&'a self) -> Option<&'a str>

Optional. HTTP or tg:// URL to be opened when the button is pressed. Links tg://user?id=<user_id> can be used to mention a user by their ID without using a username, if this is allowed by their privacy settings.

source

pub fn set_url<'a>(&'a mut self, url: Option<String>) -> &'a mut Self

Optional. HTTP or tg:// URL to be opened when the button is pressed. Links tg://user?id=<user_id> can be used to mention a user by their ID without using a username, if this is allowed by their privacy settings.

source

pub fn get_callback_data<'a>(&'a self) -> Option<Cow<'a, str>>

Optional. Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes

source

pub fn get_callback_data_ref<'a>(&'a self) -> Option<&'a str>

Optional. Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes

source

pub fn set_callback_data<'a>( &'a mut self, callback_data: Option<String> ) -> &'a mut Self

Optional. Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes

source

pub fn get_web_app<'a>(&'a self) -> Option<Cow<'a, WebAppInfo>>

Optional. Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery. Available only in private chats between a user and the bot.

source

pub fn get_web_app_ref<'a>(&'a self) -> Option<&'a WebAppInfo>

Optional. Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery. Available only in private chats between a user and the bot.

source

pub fn set_web_app<'a>( &'a mut self, web_app: Option<WebAppInfo> ) -> &'a mut Self

Optional. Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery. Available only in private chats between a user and the bot.

source

pub fn get_login_url<'a>(&'a self) -> Option<Cow<'a, LoginUrl>>

Optional. An HTTPS URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget.

source

pub fn get_login_url_ref<'a>(&'a self) -> Option<&'a LoginUrl>

Optional. An HTTPS URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget.

source

pub fn set_login_url<'a>( &'a mut self, login_url: Option<LoginUrl> ) -> &'a mut Self

Optional. An HTTPS URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget.

source

pub fn get_switch_inline_query<'a>(&'a self) -> Option<Cow<'a, str>>

Optional. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot’s username and the specified inline query in the input field. May be empty, in which case just the bot’s username will be inserted.

source

pub fn get_switch_inline_query_ref<'a>(&'a self) -> Option<&'a str>

Optional. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot’s username and the specified inline query in the input field. May be empty, in which case just the bot’s username will be inserted.

source

pub fn set_switch_inline_query<'a>( &'a mut self, switch_inline_query: Option<String> ) -> &'a mut Self

Optional. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot’s username and the specified inline query in the input field. May be empty, in which case just the bot’s username will be inserted.

source

pub fn get_switch_inline_query_current_chat<'a>( &'a self ) -> Option<Cow<'a, str>>

Optional. If set, pressing the button will insert the bot’s username and the specified inline query in the current chat’s input field. May be empty, in which case only the bot’s username will be inserted. This offers a quick way for the user to open your bot in inline mode in the same chat - good for selecting something from multiple options.

source

pub fn get_switch_inline_query_current_chat_ref<'a>(&'a self) -> Option<&'a str>

Optional. If set, pressing the button will insert the bot’s username and the specified inline query in the current chat’s input field. May be empty, in which case only the bot’s username will be inserted. This offers a quick way for the user to open your bot in inline mode in the same chat - good for selecting something from multiple options.

source

pub fn set_switch_inline_query_current_chat<'a>( &'a mut self, switch_inline_query_current_chat: Option<String> ) -> &'a mut Self

Optional. If set, pressing the button will insert the bot’s username and the specified inline query in the current chat’s input field. May be empty, in which case only the bot’s username will be inserted. This offers a quick way for the user to open your bot in inline mode in the same chat - good for selecting something from multiple options.

source

pub fn get_switch_inline_query_chosen_chat<'a>( &'a self ) -> Option<Cow<'a, SwitchInlineQueryChosenChat>>

Optional. If set, pressing the button will prompt the user to select one of their chats of the specified type, open that chat and insert the bot’s username and the specified inline query in the input field

source

pub fn get_switch_inline_query_chosen_chat_ref<'a>( &'a self ) -> Option<&'a SwitchInlineQueryChosenChat>

Optional. If set, pressing the button will prompt the user to select one of their chats of the specified type, open that chat and insert the bot’s username and the specified inline query in the input field

source

pub fn set_switch_inline_query_chosen_chat<'a>( &'a mut self, switch_inline_query_chosen_chat: Option<SwitchInlineQueryChosenChat> ) -> &'a mut Self

Optional. If set, pressing the button will prompt the user to select one of their chats of the specified type, open that chat and insert the bot’s username and the specified inline query in the input field

source

pub fn get_callback_game<'a>(&'a self) -> Option<Cow<'a, CallbackGame>>

Optional. Description of the game that will be launched when the user presses the button. NOTE: This type of button must always be the first button in the first row.

source

pub fn get_callback_game_ref<'a>(&'a self) -> Option<&'a CallbackGame>

Optional. Description of the game that will be launched when the user presses the button. NOTE: This type of button must always be the first button in the first row.

source

pub fn set_callback_game<'a>( &'a mut self, callback_game: Option<CallbackGame> ) -> &'a mut Self

Optional. Description of the game that will be launched when the user presses the button. NOTE: This type of button must always be the first button in the first row.

source

pub fn get_pay<'a>(&'a self) -> Option<bool>

Optional. Specify True, to send a Pay button. NOTE: This type of button must always be the first button in the first row and can only be used in invoice messages.

source

pub fn get_pay_ref<'a>(&'a self) -> Option<bool>

Optional. Specify True, to send a Pay button. NOTE: This type of button must always be the first button in the first row and can only be used in invoice messages.

source

pub fn set_pay<'a>(&'a mut self, pay: Option<bool>) -> &'a mut Self

Optional. Specify True, to send a Pay button. NOTE: This type of button must always be the first button in the first row and can only be used in invoice messages.

Trait Implementations§

source§

impl Clone for InlineKeyboardButton

source§

fn clone(&self) -> InlineKeyboardButton

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for InlineKeyboardButton

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for InlineKeyboardButton

source§

fn default() -> InlineKeyboardButton

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for InlineKeyboardButton

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl From<NoSkipInlineKeyboardButton> for InlineKeyboardButton

source§

fn from(t: NoSkipInlineKeyboardButton) -> Self

Converts to this type from the input type.
source§

impl Into<NoSkipInlineKeyboardButton> for InlineKeyboardButton

source§

fn into(self) -> NoSkipInlineKeyboardButton

Converts this type into the (usually inferred) input type.
source§

impl Serialize for InlineKeyboardButton

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,