[−][src]Struct tbot::event_loop::Polling
Configures and starts polling.
To construct Polling
, use Bot::polling
.
Methods
impl<C> Polling<C>
[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 [Updates]) -> Self
[src]
Configures which updates you'd like to listen to.
pub fn error_handler(
self,
handler: impl FnMut(Error<MethodCall>) + Send + Sync + 'static
) -> Self
[src]
self,
handler: impl FnMut(Error<MethodCall>) + Send + Sync + 'static
) -> Self
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<C> Polling<C> where
C: Connect + Clone + Sync + 'static,
C::Transport: 'static,
C::Future: 'static,
[src]
C: Connect + Clone + Sync + 'static,
C::Transport: 'static,
C::Future: 'static,
pub fn start(self) -> !
[src]
Starts the event loop.
pub fn delete_webhook(
&self
) -> impl Future<Item = (), Error = Error<MethodCall>>
[src]
&self
) -> impl Future<Item = (), Error = Error<MethodCall>>
Deleted the webhook of this bot.
Trait Implementations
impl<C> IntoFuture for Polling<C> where
C: Connect + Clone + Sync + 'static,
C::Transport: 'static,
C::Future: 'static,
[src]
C: Connect + Clone + Sync + 'static,
C::Transport: 'static,
C::Future: 'static,
Auto Trait Implementations
impl<C> Send for Polling<C> where
C: Send + Sync,
C: Send + Sync,
impl<C> Unpin for Polling<C>
impl<C> Sync for Polling<C> where
C: Send + Sync,
C: Send + Sync,
impl<C> !UnwindSafe for Polling<C>
impl<C> !RefUnwindSafe for Polling<C>
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<F> IntoFuture for F where
F: Future,
[src]
F: Future,
type Future = F
The future that this type can be converted into.
type Item = <F as Future>::Item
The item that the future may resolve with.
type Error = <F as Future>::Error
The error that the future may resolve with.