pub struct PollingBuilder { /* private fields */ }Expand description
Builder for configuring and starting the polling loop.
Obtained via Application::polling(). Provides a clean API without
positional None arguments.
§Example
ⓘ
use std::time::Duration;
// Minimal -- all defaults:
app.run_polling().await?;
// Custom configuration via builder:
app.polling()
.timeout(Duration::from_secs(30))
.poll_interval(Duration::from_secs(1))
.drop_pending(true)
.allowed_updates(vec!["message".into()])
.start()
.await?;Implementations§
Source§impl PollingBuilder
impl PollingBuilder
Sourcepub fn poll_interval(self, interval: Duration) -> Self
pub fn poll_interval(self, interval: Duration) -> Self
Sets the interval between polling requests. Default: zero (no delay).
Sourcepub fn timeout(self, timeout: Duration) -> Self
pub fn timeout(self, timeout: Duration) -> Self
Sets the long-polling timeout. Default: 10 seconds.
Sourcepub fn allowed_updates(self, updates: Vec<String>) -> Self
pub fn allowed_updates(self, updates: Vec<String>) -> Self
Sets the list of update types to receive. Default: all types.
Sourcepub fn drop_pending(self, drop: bool) -> Self
pub fn drop_pending(self, drop: bool) -> Self
If true, pending updates will be dropped on startup. Default: false.
Sourcepub async fn start(self) -> Result<(), ApplicationError>
pub async fn start(self) -> Result<(), ApplicationError>
Starts the polling loop with the configured parameters.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PollingBuilder
impl !RefUnwindSafe for PollingBuilder
impl Send for PollingBuilder
impl Sync for PollingBuilder
impl Unpin for PollingBuilder
impl UnsafeUnpin for PollingBuilder
impl !UnwindSafe for PollingBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more