Skip to main content

UpdatesConfiguration

Struct UpdatesConfiguration 

Source
pub struct UpdatesConfiguration {
    pub catch_up: bool,
    pub update_queue_limit: Option<usize>,
}
Expand description

Configuration that controls Client::stream_updates.

Fields§

§catch_up: bool

Should the client catch-up on updates sent to it while it was offline?

By default, updates sent while the client was offline are ignored.

§update_queue_limit: Option<usize>

How many updates may be buffered by the client at any given time.

Telegram passively sends updates to the client through the open connection, so they must be buffered until the application has the capacity to consume them.

Upon reaching this limit, updates will be dropped, and a warning log message will be emitted (but not too often, to avoid spamming the log), in order to let the developer know that they should either change how they handle updates or increase the limit.

A limit of zero (Some(0)) indicates that updates should not be buffered. They will be immediately dropped, and no warning will ever be emitted.

A limit of None disables the upper bound for the buffer. This is not recommended, as it could eventually lead to memory exhaustion. This option will also not emit any warnings.

The default limit, which may change at any time, should be enough for user accounts, although bot accounts may need to increase the limit depending on their capacity.

When the limit is Some, a buffer to hold that many updates will be pre-allocated.

Trait Implementations§

Source§

impl Default for UpdatesConfiguration

Source§

fn default() -> Self

Returns an instance that will not catch up, with a queue limit of 100 updates.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.