Struct teloxide::types::Update

source ·
pub struct Update {
    pub id: i32,
    pub kind: UpdateKind,
}
Expand description

This object represents an incoming update.

The official docs.

Fields§

§id: i32

The update‘s unique identifier. 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.

§kind: UpdateKind

Implementations§

source§

impl Update

source

pub fn user(&self) -> Option<&User>

Returns the user that performed the action that caused this update, if known.

This is generally the from field (except for PollAnswer where it’s user and Poll with Error which don’t have such field at all).

source

pub fn chat(&self) -> Option<&Chat>

Returns the chat in which is update has happened, if any.

Trait Implementations§

source§

impl Clone for Update

source§

fn clone(&self) -> Update

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 Update

source§

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

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

impl<'de> Deserialize<'de> for Update

source§

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 GetChatId for Update

source§

impl PartialEq<Update> for Update

source§

fn eq(&self, other: &Update) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for Update

source§

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<Out> UpdateFilterExt<Out> for Updatewhere Out: Send + Sync + 'static,

source§

fn filter_message( ) -> Handler<'static, DependencyMap, Out, DpHandlerDescription>

Filters out UpdateKind::Message objects.
source§

fn filter_edited_message( ) -> Handler<'static, DependencyMap, Out, DpHandlerDescription>

Filters out UpdateKind::EditedMessage objects.
source§

fn filter_channel_post( ) -> Handler<'static, DependencyMap, Out, DpHandlerDescription>

Filters out UpdateKind::ChannelPost objects.
source§

fn filter_edited_channel_post( ) -> Handler<'static, DependencyMap, Out, DpHandlerDescription>

Filters out UpdateKind::EditedChannelPost objects.
source§

fn filter_inline_query( ) -> Handler<'static, DependencyMap, Out, DpHandlerDescription>

Filters out UpdateKind::InlineQuery objects.
source§

fn filter_chosen_inline_result( ) -> Handler<'static, DependencyMap, Out, DpHandlerDescription>

Filters out UpdateKind::ChosenInlineResult objects.
source§

fn filter_callback_query( ) -> Handler<'static, DependencyMap, Out, DpHandlerDescription>

Filters out UpdateKind::CallbackQuery objects.
source§

fn filter_shipping_query( ) -> Handler<'static, DependencyMap, Out, DpHandlerDescription>

Filters out UpdateKind::ShippingQuery objects.
source§

fn filter_pre_checkout_query( ) -> Handler<'static, DependencyMap, Out, DpHandlerDescription>

Filters out UpdateKind::PreCheckoutQuery objects.
source§

fn filter_poll() -> Handler<'static, DependencyMap, Out, DpHandlerDescription>

Filters out UpdateKind::Poll objects.
source§

fn filter_poll_answer( ) -> Handler<'static, DependencyMap, Out, DpHandlerDescription>

Filters out UpdateKind::PollAnswer objects.
source§

fn filter_my_chat_member( ) -> Handler<'static, DependencyMap, Out, DpHandlerDescription>

Filters out UpdateKind::MyChatMember objects.
source§

fn filter_chat_member( ) -> Handler<'static, DependencyMap, Out, DpHandlerDescription>

Filters out UpdateKind::ChatMember objects.
source§

fn filter_chat_join_request( ) -> Handler<'static, DependencyMap, Out, DpHandlerDescription>

Filters out UpdateKind::ChatJoinRequest objects.
source§

impl StructuralPartialEq for Update

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,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
§

impl<T> Erasable for T

§

unsafe fn unerase(this: NonNull<Erased>) -> NonNull<T>

Unerase this erased pointer. Read more
§

const ACK_1_1_0: bool = true

Available on non-enforce_1_1_0_semantics only.
Whether this implementor has acknowledged the 1.1.0 update to unerase’s documented implementation requirements. Read more
§

fn erase(this: NonNull<Self>) -> NonNull<Erased>

Turn this erasable pointer into an erased pointer. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromRef<T> for Twhere T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
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>,

const: unstable · 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.
const: unstable · 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.
const: unstable · 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>,