Enum tbot::types::parameters::CallbackAction[][src]

#[must_use]
pub enum CallbackAction {
    Text(Stringbool),
    Url(String),
}

Represent possible actions for AnswerCallbackQuery.

Though you can consturct variants directly, there are convenient methods to do that: with_notification, with_alert and with_url.

Variants

Text(Stringbool)

Show text to the user. The last item configures show_alert.

Url(String)

Open a URL.

Implementations

impl CallbackAction[src]

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

Returns true if self is of variant Text.

pub fn expect_text(self) -> (String, bool) where
    Self: Debug
[src]

Unwraps the value, yielding the content of Text.

Panics

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

pub fn text(self) -> Option<(String, bool)>[src]

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

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.

impl CallbackAction[src]

pub fn with_notification(text: impl Into<String>) -> Self[src]

Constructs the Text variant that shows a simple notification.

pub fn with_alert(text: impl Into<String>) -> Self[src]

Constructs the Text variant that shows an alert.

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

Constructs the Url variant.

Trait Implementations

impl Clone for CallbackAction[src]

impl Debug for CallbackAction[src]

impl Hash for CallbackAction[src]

impl PartialEq<CallbackAction> for CallbackAction[src]

impl Eq for CallbackAction[src]

impl StructuralEq for CallbackAction[src]

impl StructuralPartialEq for CallbackAction[src]

Auto Trait Implementations

impl RefUnwindSafe for CallbackAction

impl Send for CallbackAction

impl Sync for CallbackAction

impl Unpin for CallbackAction

impl UnwindSafe for CallbackAction

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.