pub struct TimerBuilder { /* private fields */ }Expand description
Builds and starts a timer with less boilerplate.
Implementations§
Source§impl TimerBuilder
impl TimerBuilder
Sourcepub fn expiration_count(self, expiration_count: usize) -> Self
pub fn expiration_count(self, expiration_count: usize) -> Self
Sets the expiration count for a recurring timer.
Sourcepub fn initial_delay(self, initial_delay: Duration) -> Self
pub fn initial_delay(self, initial_delay: Duration) -> Self
Sets an initial delay before the first recurring execution.
Sourcepub fn callback_timeout(self, callback_timeout: Duration) -> Self
pub fn callback_timeout(self, callback_timeout: Duration) -> Self
Sets a timeout for each callback execution.
Sourcepub fn retry_policy(self, retry_policy: RetryPolicy) -> Self
pub fn retry_policy(self, retry_policy: RetryPolicy) -> Self
Retries failed callback executions according to the provided policy.
Sourcepub fn max_retries(self, max_retries: usize) -> Self
pub fn max_retries(self, max_retries: usize) -> Self
Retries failed callback executions up to max_retries times.
Sourcepub fn paused_start(self) -> Self
pub fn paused_start(self) -> Self
Starts the timer in the paused state.
Sourcepub fn with_events_disabled(self) -> Self
pub fn with_events_disabled(self) -> Self
Disables broadcast event emission for the timer.
Sourcepub async fn start<F>(self, callback: F) -> Result<Timer, TimerError>where
F: TimerCallback + 'static,
pub async fn start<F>(self, callback: F) -> Result<Timer, TimerError>where
F: TimerCallback + 'static,
Starts the configured timer and returns the handle.
Auto Trait Implementations§
impl Freeze for TimerBuilder
impl RefUnwindSafe for TimerBuilder
impl Send for TimerBuilder
impl Sync for TimerBuilder
impl Unpin for TimerBuilder
impl UnsafeUnpin for TimerBuilder
impl UnwindSafe for TimerBuilder
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