[][src]Struct tbot::event_loop::Polling

#[must_use = "polling does nothing unless `start` is called"]pub struct Polling { /* fields omitted */ }

Configures and starts polling.

To construct Polling, use Bot::polling.

Implementations

impl Polling[src]

pub fn limit(self, limit: u8) -> Self[src]

Configures the limit of updates per request.

pub fn timeout(self, timeout: u64) -> Self[src]

Configures the timeout for long polling.

pub fn allowed_updates(self, allowed_updates: &'static [UpdateKind]) -> Self[src]

Configures which updates you'd like to listen to.

pub fn error_handler<H, F>(self, handler: H) -> Self where
    H: Fn(Polling) -> F + Send + Sync + 'static,
    F: Future<Output = ()> + Send + 'static, 
[src]

Adds a handler for errors ocurred while polling.

pub const fn poll_interval(self, poll_interval: Duration) -> Self[src]

Configures the minimal interval between making requests. Set to 25ms by default.

pub const fn request_timeout(self, timeout: Duration) -> Self[src]

Configures for how long tbot should wait for getUpdates. If this timeout is exceeded, an error handler is triggered. If you don't configure this value, it is set to Duration::from_secs(timeout.unwrap_or(0) + 60).

pub fn last_n_updates(self, n: NonZeroUsize) -> Self[src]

Configures how many updates tbot will process on start. If configured, tbot sets offset's value to -n when making the first request.

Panics

Panics if n can't be converted to isize safely.

impl Polling[src]

pub async fn start(self) -> Result<Infallible, PollingSetup>[src]

Starts the event loop.

Auto Trait Implementations

impl !RefUnwindSafe for Polling

impl Send for Polling

impl Sync for Polling

impl Unpin for Polling

impl !UnwindSafe for Polling

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> WithSubscriber for T[src]