Struct delay::Delay [−][src]
A Delay struct that encapsulates a Waiter.
To use this class, first create an instance of it by either calling a method on it (like Delay::timeout) or create a builder and add multiple Waiters. Then when you're ready to start a process that needs to wait, use the [start()] function. Every wait period, call the [wait()] function on it (it may block the thread).
Implementations
impl Delay
[src]
pub fn instant() -> Self
[src]
A Delay that never waits. This can hog resources, so careful.
pub fn timeout(timeout: Duration) -> Self
[src]
A Delay that doesn't wait, but times out after a while.
pub fn count_timeout(count: u64) -> Self
[src]
A Delay that times out after waiting a certain number of times.
pub fn throttle(throttle: Duration) -> Self
[src]
A delay that waits every wait() call for a certain time.
pub fn exponential_backoff_capped(
initial: Duration,
multiplier: f32,
cap: Duration
) -> Self
[src]
initial: Duration,
multiplier: f32,
cap: Duration
) -> Self
A delay that recalculate a wait time every wait() calls and exponentially waits. The calculation is new_wait_time = max(current_wait_time * multiplier, cap).
pub fn exponential_backoff(initial: Duration, multiplier: f32) -> Self
[src]
A delay that recalculate a wait time every wait() calls and exponentially waits. The calculation is new_wait_time = current_wait_time * multiplier. There is no limit for this backoff.
pub fn side_effect<F>(function: F) -> Self where
F: 'static + Sync + Send + Clone + Fn() -> Result<(), WaiterError>,
[src]
F: 'static + Sync + Send + Clone + Fn() -> Result<(), WaiterError>,
Call a function every tick, expecting some kind of side effect (e.g. a progress bar).
pub fn builder() -> DelayBuilder
[src]
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Delay
[src]
impl Send for Delay
[src]
impl !Sync for Delay
[src]
impl Unpin for Delay
[src]
impl !UnwindSafe for Delay
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
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.
pub 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.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> WaiterClone for T where
T: 'static + Waiter + Clone,
[src]
T: 'static + Waiter + Clone,