Struct garcon::Delay [−][src]
pub struct Delay { /* fields omitted */ }
Expand description
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]
impl Delay
[src]pub fn from(inner: Box<dyn Waiter>) -> Self
[src]
pub fn timeout(timeout: Duration) -> Self
[src]
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]
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]
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]
pub fn exponential_backoff_capped(
initial: Duration,
multiplier: f32,
cap: Duration
) -> Self
[src]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]
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]
pub fn side_effect<F>(function: F) -> Self where
F: 'static + Sync + Send + Clone + Fn() -> Result<(), WaiterError>,
[src]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
impl Send for Delay
impl Sync for Delay
impl Unpin for Delay
impl !UnwindSafe for Delay
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more