pub struct Update {
pub id: Integer,
pub update_type: UpdateType,
}
Expand description
Represents an incoming update.
Fields§
§id: Integer
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: Integer, update_type: UpdateType) -> Self
pub fn new(id: Integer, update_type: UpdateType) -> Self
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<Self, __D::Error>where
__D: Deserializer<'de>,
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<UnexpectedUpdate> for Update
impl From<UnexpectedUpdate> for Update
source§fn from(value: UnexpectedUpdate) -> Self
fn from(value: UnexpectedUpdate) -> Self
Converts to this type from the input type.
source§impl PartialEq for Update
impl PartialEq for Update
source§impl TryFrom<Update> for BusinessConnection
impl TryFrom<Update> for BusinessConnection
source§impl TryFrom<Update> for BusinessMessagesDeleted
impl TryFrom<Update> for BusinessMessagesDeleted
source§impl TryFrom<Update> for CallbackQuery
impl TryFrom<Update> for CallbackQuery
source§impl TryFrom<Update> for ChatJoinRequest
impl TryFrom<Update> for ChatJoinRequest
source§impl TryFrom<Update> for ChatMemberUpdated
impl TryFrom<Update> for ChatMemberUpdated
source§impl TryFrom<Update> for ChosenInlineResult
impl TryFrom<Update> for ChosenInlineResult
source§impl TryFrom<Update> for InlineQuery
impl TryFrom<Update> for InlineQuery
source§impl TryFrom<Update> for PollAnswer
impl TryFrom<Update> for PollAnswer
source§impl TryFrom<Update> for PreCheckoutQuery
impl TryFrom<Update> for PreCheckoutQuery
source§impl TryFrom<Update> for ShippingQuery
impl TryFrom<Update> for ShippingQuery
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