pub trait TimeoutConditionWaiter: ConditionWaiter {
// Required method
fn wait_while_for<R, P, F>(
&self,
timeout: Duration,
predicate: P,
action: F,
) -> WaitTimeoutResult<R>
where P: FnMut(&Self::State) -> bool,
F: FnOnce(&mut Self::State) -> R;
// Provided method
fn wait_until_for<R, P, F>(
&self,
timeout: Duration,
predicate: P,
action: F,
) -> WaitTimeoutResult<R>
where P: FnMut(&Self::State) -> bool,
F: FnOnce(&mut Self::State) -> R { ... }
}Expand description
Waits for predicates over protected state with relative timeouts.
Required Methods§
Sourcefn wait_while_for<R, P, F>(
&self,
timeout: Duration,
predicate: P,
action: F,
) -> WaitTimeoutResult<R>
fn wait_while_for<R, P, F>( &self, timeout: Duration, predicate: P, action: F, ) -> WaitTimeoutResult<R>
Blocks while the predicate remains true or until the timeout expires.
§Arguments
timeout- Maximum relative duration to wait.predicate- Predicate that returnstruewhile waiting should continue.action- Action to run after the predicate becomes false.
§Returns
WaitTimeoutResult::Ready with the action result, or
WaitTimeoutResult::TimedOut when the timeout expires first.
Provided Methods§
Sourcefn wait_until_for<R, P, F>(
&self,
timeout: Duration,
predicate: P,
action: F,
) -> WaitTimeoutResult<R>
fn wait_until_for<R, P, F>( &self, timeout: Duration, predicate: P, action: F, ) -> WaitTimeoutResult<R>
Blocks until the predicate becomes true or the timeout expires.
§Arguments
timeout- Maximum relative duration to wait.predicate- Predicate that returnstruewhen the state is ready.action- Action to run after the predicate becomes true.
§Returns
WaitTimeoutResult::Ready with the action result, or
WaitTimeoutResult::TimedOut when the timeout expires first.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.