pub struct Polling<S> { /* private fields */ }
Expand description
Configures and starts polling for the stateful event loop.
To construct Polling
, use StatefulEventLoop::polling
.
Implementations§
source§impl<S> Polling<S>
impl<S> Polling<S>
sourcepub fn into_stateless(self) -> Polling
pub fn into_stateless(self) -> Polling
Turns this polling into a stateless one. Previous configuration
sourcepub fn with_other_state<T>(self, other_state: T) -> Polling<T>where
T: Send + Sync + 'static,
pub fn with_other_state<T>(self, other_state: T) -> Polling<T>where
T: Send + Sync + 'static,
Turns this polling into another with other state.
sourcepub fn allowed_updates(self, allowed_updates: AllowedUpdates) -> Self
pub fn allowed_updates(self, allowed_updates: AllowedUpdates) -> Self
Configures which updates you’d like to listen to.
sourcepub fn poll_interval(self, poll_interval: Duration) -> Self
pub fn poll_interval(self, poll_interval: Duration) -> Self
Configures the minimal interval between making requests. Set to 25ms
by default.
sourcepub fn request_timeout(self, timeout: Duration) -> Self
pub fn request_timeout(self, timeout: Duration) -> Self
Configures for how long tbot
should wait for getUpdates
. If this
timeout is exceeded, the error handler is triggered. If you don’t
configure this value, it is set to
Duration::from_secs(timeout.unwrap_or(0) + 60)
.
sourcepub fn last_n_updates(self, n: NonZeroUsize) -> Self
pub fn last_n_updates(self, n: NonZeroUsize) -> Self
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.
sourcepub async fn start(self) -> Result<Infallible, PollingSetup>
pub async fn start(self) -> Result<Infallible, PollingSetup>
Starts the event loop.