pub trait ConditionWaiter {
type State;
// Required methods
fn wait_until<R, P, F>(&self, predicate: P, action: F) -> R
where P: FnMut(&Self::State) -> bool,
F: FnOnce(&mut Self::State) -> R;
fn wait_while<R, P, F>(&self, predicate: P, action: F) -> R
where P: FnMut(&Self::State) -> bool,
F: FnOnce(&mut Self::State) -> R;
}Expand description
Waits for predicates over protected monitor state.
Required Associated Types§
Required Methods§
Sourcefn wait_until<R, P, F>(&self, predicate: P, action: F) -> R
fn wait_until<R, P, F>(&self, predicate: P, action: F) -> R
Sourcefn wait_while<R, P, F>(&self, predicate: P, action: F) -> R
fn wait_while<R, P, F>(&self, predicate: P, action: F) -> R
Blocks while the predicate remains true, then runs an action.
The predicate and action run while the monitor state is locked.
§Arguments
predicate- Predicate that returnstruewhile waiting should continue.action- Action to run after the predicate becomes false.
§Returns
The value returned by action.
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.