pub struct Update {
pub id: i64,
pub update_type: UpdateType,
}
Expand description
Represents an incoming update.
Fields§
§id: i64
Unique identifier of the update.
Update identifiers start from a certain positive number and increase sequentially. This ID becomes especially handy if you’re using Webhooks, since it allows you to ignore repeated updates or to restore the correct update sequence, should they get out of order. If there are no new updates for at least a week, then identifier of the next update will be chosen randomly instead of sequentially.
update_type: UpdateType
Type of the update.
Implementations§
source§impl Update
impl Update
sourcepub fn new(id: i64, update_type: UpdateType) -> Update
pub fn new(id: i64, update_type: UpdateType) -> Update
Creates a new Update
.
§Arguments
id
- Unique identifier of the update.update_type
- Type of the update.
sourcepub fn get_chat_id(&self) -> Option<ChatPeerId>
pub fn get_chat_id(&self) -> Option<ChatPeerId>
Returns the ID of the chat.
sourcepub fn get_chat_username(&self) -> Option<&ChatUsername>
pub fn get_chat_username(&self) -> Option<&ChatUsername>
Returns the username of the chat.
sourcepub fn get_user_id(&self) -> Option<UserPeerId>
pub fn get_user_id(&self) -> Option<UserPeerId>
Returns the ID of the user.
sourcepub fn get_user_username(&self) -> Option<&UserUsername>
pub fn get_user_username(&self) -> Option<&UserUsername>
Returns the username of the user.
sourcepub fn get_message(&self) -> Option<&Message>
pub fn get_message(&self) -> Option<&Message>
Returns the message.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Update
impl<'de> Deserialize<'de> for Update
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<Update, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<Update, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl From<UnexpectedUpdate> for Update
impl From<UnexpectedUpdate> for Update
source§fn from(value: UnexpectedUpdate) -> Update
fn from(value: UnexpectedUpdate) -> Update
Converts to this type from the input type.
source§impl From<Update> for HandlerInput
impl From<Update> for HandlerInput
source§impl PartialEq for Update
impl PartialEq for Update
source§impl Serialize for Update
impl Serialize for Update
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
source§impl TryFrom<Update> for BusinessConnection
impl TryFrom<Update> for BusinessConnection
§type Error = UnexpectedUpdate
type Error = UnexpectedUpdate
The type returned in the event of a conversion error.
source§fn try_from(
value: Update
) -> Result<BusinessConnection, <BusinessConnection as TryFrom<Update>>::Error>
fn try_from( value: Update ) -> Result<BusinessConnection, <BusinessConnection as TryFrom<Update>>::Error>
Performs the conversion.
source§impl TryFrom<Update> for BusinessMessagesDeleted
impl TryFrom<Update> for BusinessMessagesDeleted
§type Error = UnexpectedUpdate
type Error = UnexpectedUpdate
The type returned in the event of a conversion error.
source§fn try_from(
value: Update
) -> Result<BusinessMessagesDeleted, <BusinessMessagesDeleted as TryFrom<Update>>::Error>
fn try_from( value: Update ) -> Result<BusinessMessagesDeleted, <BusinessMessagesDeleted as TryFrom<Update>>::Error>
Performs the conversion.
source§impl TryFrom<Update> for CallbackQuery
impl TryFrom<Update> for CallbackQuery
§type Error = UnexpectedUpdate
type Error = UnexpectedUpdate
The type returned in the event of a conversion error.
source§fn try_from(
value: Update
) -> Result<CallbackQuery, <CallbackQuery as TryFrom<Update>>::Error>
fn try_from( value: Update ) -> Result<CallbackQuery, <CallbackQuery as TryFrom<Update>>::Error>
Performs the conversion.
source§impl TryFrom<Update> for ChatJoinRequest
impl TryFrom<Update> for ChatJoinRequest
§type Error = UnexpectedUpdate
type Error = UnexpectedUpdate
The type returned in the event of a conversion error.
source§fn try_from(
value: Update
) -> Result<ChatJoinRequest, <ChatJoinRequest as TryFrom<Update>>::Error>
fn try_from( value: Update ) -> Result<ChatJoinRequest, <ChatJoinRequest as TryFrom<Update>>::Error>
Performs the conversion.
source§impl TryFrom<Update> for ChatMemberUpdated
impl TryFrom<Update> for ChatMemberUpdated
§type Error = UnexpectedUpdate
type Error = UnexpectedUpdate
The type returned in the event of a conversion error.
source§fn try_from(
value: Update
) -> Result<ChatMemberUpdated, <ChatMemberUpdated as TryFrom<Update>>::Error>
fn try_from( value: Update ) -> Result<ChatMemberUpdated, <ChatMemberUpdated as TryFrom<Update>>::Error>
Performs the conversion.
source§impl TryFrom<Update> for ChosenInlineResult
impl TryFrom<Update> for ChosenInlineResult
§type Error = UnexpectedUpdate
type Error = UnexpectedUpdate
The type returned in the event of a conversion error.
source§fn try_from(
value: Update
) -> Result<ChosenInlineResult, <ChosenInlineResult as TryFrom<Update>>::Error>
fn try_from( value: Update ) -> Result<ChosenInlineResult, <ChosenInlineResult as TryFrom<Update>>::Error>
Performs the conversion.
source§impl TryFrom<Update> for InlineQuery
impl TryFrom<Update> for InlineQuery
§type Error = UnexpectedUpdate
type Error = UnexpectedUpdate
The type returned in the event of a conversion error.
source§fn try_from(
value: Update
) -> Result<InlineQuery, <InlineQuery as TryFrom<Update>>::Error>
fn try_from( value: Update ) -> Result<InlineQuery, <InlineQuery as TryFrom<Update>>::Error>
Performs the conversion.
source§impl TryFrom<Update> for PollAnswer
impl TryFrom<Update> for PollAnswer
§type Error = UnexpectedUpdate
type Error = UnexpectedUpdate
The type returned in the event of a conversion error.
source§fn try_from(
value: Update
) -> Result<PollAnswer, <PollAnswer as TryFrom<Update>>::Error>
fn try_from( value: Update ) -> Result<PollAnswer, <PollAnswer as TryFrom<Update>>::Error>
Performs the conversion.
source§impl TryFrom<Update> for PreCheckoutQuery
impl TryFrom<Update> for PreCheckoutQuery
§type Error = UnexpectedUpdate
type Error = UnexpectedUpdate
The type returned in the event of a conversion error.
source§fn try_from(
value: Update
) -> Result<PreCheckoutQuery, <PreCheckoutQuery as TryFrom<Update>>::Error>
fn try_from( value: Update ) -> Result<PreCheckoutQuery, <PreCheckoutQuery as TryFrom<Update>>::Error>
Performs the conversion.
source§impl TryFrom<Update> for ShippingQuery
impl TryFrom<Update> for ShippingQuery
§type Error = UnexpectedUpdate
type Error = UnexpectedUpdate
The type returned in the event of a conversion error.
source§fn try_from(
value: Update
) -> Result<ShippingQuery, <ShippingQuery as TryFrom<Update>>::Error>
fn try_from( value: Update ) -> Result<ShippingQuery, <ShippingQuery as TryFrom<Update>>::Error>
Performs the conversion.
source§impl TryFromInput for Update
impl TryFromInput for Update
§type Error = Infallible
type Error = Infallible
An error when conversion failed.
source§async fn try_from_input(
input: HandlerInput
) -> Result<Option<Self>, Self::Error>
async fn try_from_input( input: HandlerInput ) -> Result<Option<Self>, Self::Error>
Performs conversion. Read more
impl StructuralPartialEq for Update
Auto Trait Implementations§
impl Freeze for Update
impl RefUnwindSafe for Update
impl Send for Update
impl Sync for Update
impl Unpin for Update
impl UnwindSafe for Update
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more