Skip to main content

AsyncTimeoutConditionWaiter

Trait AsyncTimeoutConditionWaiter 

Source
pub trait AsyncTimeoutConditionWaiter: AsyncConditionWaiter {
    // Required method
    fn wait_while_for_async<'a, R, P, F>(
        &'a self,
        timeout: Duration,
        predicate: P,
        action: F,
    ) -> AsyncMonitorFuture<'a, WaitTimeoutResult<R>>
       where R: Send + 'a,
             P: FnMut(&Self::State) -> bool + Send + 'a,
             F: FnOnce(&mut Self::State) -> R + Send + 'a;

    // Provided method
    fn wait_until_for_async<'a, R, P, F>(
        &'a self,
        timeout: Duration,
        predicate: P,
        action: F,
    ) -> AsyncMonitorFuture<'a, WaitTimeoutResult<R>>
       where R: Send + 'a,
             P: FnMut(&Self::State) -> bool + Send + 'a,
             F: FnOnce(&mut Self::State) -> R + Send + 'a { ... }
}
Expand description

Waits asynchronously for predicates over protected state with timeouts.

Required Methods§

Source

fn wait_while_for_async<'a, R, P, F>( &'a self, timeout: Duration, predicate: P, action: F, ) -> AsyncMonitorFuture<'a, WaitTimeoutResult<R>>
where R: Send + 'a, P: FnMut(&Self::State) -> bool + Send + 'a, F: FnOnce(&mut Self::State) -> R + Send + 'a,

Returns a future that waits while the predicate remains true or times out.

The timeout budget is measured from this method call.

Provided Methods§

Source

fn wait_until_for_async<'a, R, P, F>( &'a self, timeout: Duration, predicate: P, action: F, ) -> AsyncMonitorFuture<'a, WaitTimeoutResult<R>>
where R: Send + 'a, P: FnMut(&Self::State) -> bool + Send + 'a, F: FnOnce(&mut Self::State) -> R + Send + 'a,

Returns a future that waits until the predicate becomes true or times out.

The timeout budget is measured from this method call.

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.

Implementors§

Source§

impl<T: Send> AsyncTimeoutConditionWaiter for ArcMockMonitor<T>

Available on crate feature async only.
Source§

impl<T: Send> AsyncTimeoutConditionWaiter for ArcTokioMonitor<T>

Source§

impl<T: Send> AsyncTimeoutConditionWaiter for MockMonitor<T>

Available on crate feature async only.
Source§

impl<T: Send> AsyncTimeoutConditionWaiter for TokioMonitor<T>