Enum tbot::types::update::Kind

source ·
#[non_exhaustive]
pub enum Kind {
Show 14 variants Message(Message), EditedMessage(Message), ChannelPost(Message), EditedChannelPost(Message), InlineQuery(InlineQuery), CallbackQuery(Query), Poll(Poll), PollAnswer(Answer), ChosenInlineResult(ChosenInlineResult), ShippingQuery(Query), PreCheckoutQuery(PreCheckoutQuery), MyChatMember(Updated), ChatMember(Updated), Unknown,
}
Expand description

Represents different types of updates from Telegram.

Variants (Non-exhaustive)§

This enum is marked as 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.
§

Message(Message)

A new chat message.

§

EditedMessage(Message)

An edited message.

§

ChannelPost(Message)

A new channel post.

§

EditedChannelPost(Message)

An edited channel post.

§

InlineQuery(InlineQuery)

An inline query.

§

CallbackQuery(Query)

An incoming callback query.

§

Poll(Poll)

A new state of a poll.

§

PollAnswer(Answer)

A user changed their answer in a non-anonymous poll.

§

ChosenInlineResult(ChosenInlineResult)

A chosen inline result.

§

ShippingQuery(Query)

A shipping query.

§

PreCheckoutQuery(PreCheckoutQuery)

A pre-checkout query.

§

MyChatMember(Updated)

The bot’s chat member status was updated.

§

ChatMember(Updated)

A user’s chat member status was updated.

§

Unknown

Unknown update kind.

Implementations§

Returns true if self is of variant Message.

Unwraps the value, yielding the content of Message.

Panics

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

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

Returns true if self is of variant EditedMessage.

Unwraps the value, yielding the content of EditedMessage.

Panics

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

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

source

pub fn is_channel_post(&self) -> bool

Returns true if self is of variant ChannelPost.

source

pub fn expect_channel_post(self) -> Messagewhere
    Self: Debug,

Unwraps the value, yielding the content of ChannelPost.

Panics

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

source

pub fn channel_post(self) -> Option<Message>

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

source

pub fn is_edited_channel_post(&self) -> bool

Returns true if self is of variant EditedChannelPost.

source

pub fn expect_edited_channel_post(self) -> Messagewhere
    Self: Debug,

Unwraps the value, yielding the content of EditedChannelPost.

Panics

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

source

pub fn edited_channel_post(self) -> Option<Message>

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

Returns true if self is of variant InlineQuery.

Unwraps the value, yielding the content of InlineQuery.

Panics

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

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

Returns true if self is of variant CallbackQuery.

Unwraps the value, yielding the content of CallbackQuery.

Panics

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

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

Returns true if self is of variant Poll.

Unwraps the value, yielding the content of Poll.

Panics

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

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

Returns true if self is of variant PollAnswer.

Unwraps the value, yielding the content of PollAnswer.

Panics

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

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

Returns true if self is of variant ChosenInlineResult.

Unwraps the value, yielding the content of ChosenInlineResult.

Panics

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

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

Returns true if self is of variant ShippingQuery.

Unwraps the value, yielding the content of ShippingQuery.

Panics

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

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

Returns true if self is of variant PreCheckoutQuery.

Unwraps the value, yielding the content of PreCheckoutQuery.

Panics

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

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

Returns true if self is of variant MyChatMember.

Unwraps the value, yielding the content of MyChatMember.

Panics

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

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

Returns true if self is of variant ChatMember.

Unwraps the value, yielding the content of ChatMember.

Panics

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

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

Returns true if self is of variant Unknown.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

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

Calls U::from(self).

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

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more