pub struct ArcMockMonitor<T> { /* private fields */ }Expand description
Cloneable handle around a MockMonitor.
Implementations§
Source§impl<T> ArcMockMonitor<T>
impl<T> ArcMockMonitor<T>
Sourcepub fn set_elapsed(&self, elapsed: Duration)
pub fn set_elapsed(&self, elapsed: Duration)
Sourcepub fn reset_elapsed(&self)
pub fn reset_elapsed(&self)
Resets mock elapsed time to zero.
Sourcepub fn write_notify_one<R, F>(&self, f: F) -> R
pub fn write_notify_one<R, F>(&self, f: F) -> R
Mutates protected state and wakes one waiter.
Sourcepub fn write_notify_all<R, F>(&self, f: F) -> R
pub fn write_notify_all<R, F>(&self, f: F) -> R
Mutates protected state and wakes all waiters.
Sourcepub fn notify_one(&self)
pub fn notify_one(&self)
Wakes one waiter.
Sourcepub fn notify_all(&self)
pub fn notify_all(&self)
Wakes all waiters.
Methods from Deref<Target = MockMonitor<T>>§
Sourcepub fn set_elapsed(&self, elapsed: Duration)
pub fn set_elapsed(&self, elapsed: Duration)
Sets the current mock elapsed time.
This wakes timeout waiters so they can recheck their budgets.
§Arguments
elapsed- New mock elapsed time.
Sourcepub fn advance(&self, duration: Duration)
pub fn advance(&self, duration: Duration)
Advances mock elapsed time by a relative duration.
§Arguments
duration- Duration added to the current mock elapsed time.
Sourcepub fn reset_elapsed(&self)
pub fn reset_elapsed(&self)
Resets mock elapsed time to zero.
Sourcepub fn write_notify_one<R, F>(&self, f: F) -> R
pub fn write_notify_one<R, F>(&self, f: F) -> R
Sourcepub fn write_notify_all<R, F>(&self, f: F) -> R
pub fn write_notify_all<R, F>(&self, f: F) -> R
Sourcepub fn notify_one(&self)
pub fn notify_one(&self)
Wakes one waiter if one is blocked.
Sourcepub fn notify_all(&self)
pub fn notify_all(&self)
Wakes all waiters.
Trait Implementations§
Source§impl<T> AsRef<MockMonitor<T>> for ArcMockMonitor<T>
impl<T> AsRef<MockMonitor<T>> for ArcMockMonitor<T>
Source§fn as_ref(&self) -> &MockMonitor<T>
fn as_ref(&self) -> &MockMonitor<T>
Returns a reference to the wrapped mock monitor.
Source§impl<T: Send> AsyncConditionWaiter for ArcMockMonitor<T>
Available on crate feature async only.
impl<T: Send> AsyncConditionWaiter for ArcMockMonitor<T>
async only.Source§fn async_wait_until<'a, R, P, F>(
&'a self,
predicate: P,
action: F,
) -> AsyncMonitorFuture<'a, R>
fn async_wait_until<'a, R, P, F>( &'a self, predicate: P, action: F, ) -> AsyncMonitorFuture<'a, R>
Returns a future that waits until the predicate becomes true.
Source§fn async_wait_while<'a, R, P, F>(
&'a self,
predicate: P,
action: F,
) -> AsyncMonitorFuture<'a, R>
fn async_wait_while<'a, R, P, F>( &'a self, predicate: P, action: F, ) -> AsyncMonitorFuture<'a, R>
Returns a future that waits while the predicate remains true.
Source§impl<T: Send> AsyncNotificationWaiter for ArcMockMonitor<T>
Available on crate feature async only.
impl<T: Send> AsyncNotificationWaiter for ArcMockMonitor<T>
async only.Source§fn async_wait<'a>(&'a self) -> AsyncMonitorFuture<'a, ()>
fn async_wait<'a>(&'a self) -> AsyncMonitorFuture<'a, ()>
Returns a future that resolves after an async notification.
Source§impl<T: Send> AsyncTimeoutConditionWaiter for ArcMockMonitor<T>
Available on crate feature async only.
impl<T: Send> AsyncTimeoutConditionWaiter for ArcMockMonitor<T>
async only.Source§fn async_wait_until_for<'a, R, P, F>(
&'a self,
timeout: Duration,
predicate: P,
action: F,
) -> AsyncMonitorFuture<'a, WaitTimeoutResult<R>>
fn async_wait_until_for<'a, R, P, F>( &'a self, timeout: Duration, predicate: P, action: F, ) -> AsyncMonitorFuture<'a, WaitTimeoutResult<R>>
Returns a future that waits until the predicate becomes true or times out.
Source§fn async_wait_while_for<'a, R, P, F>(
&'a self,
timeout: Duration,
predicate: P,
action: F,
) -> AsyncMonitorFuture<'a, WaitTimeoutResult<R>>
fn async_wait_while_for<'a, R, P, F>( &'a self, timeout: Duration, predicate: P, action: F, ) -> AsyncMonitorFuture<'a, WaitTimeoutResult<R>>
Returns a future that waits while the predicate remains true or times out.
Source§impl<T: Send> AsyncTimeoutNotificationWaiter for ArcMockMonitor<T>
Available on crate feature async only.
impl<T: Send> AsyncTimeoutNotificationWaiter for ArcMockMonitor<T>
async only.Source§fn async_wait_for<'a>(
&'a self,
timeout: Duration,
) -> AsyncMonitorFuture<'a, WaitTimeoutStatus>
fn async_wait_for<'a>( &'a self, timeout: Duration, ) -> AsyncMonitorFuture<'a, WaitTimeoutStatus>
Returns a future that resolves after notification or mock timeout.
Source§impl<T> Clone for ArcMockMonitor<T>
impl<T> Clone for ArcMockMonitor<T>
Source§impl<T> ConditionWaiter for ArcMockMonitor<T>
impl<T> ConditionWaiter for ArcMockMonitor<T>
Source§fn wait_until<R, P, F>(&self, predicate: P, action: F) -> R
fn wait_until<R, P, F>(&self, predicate: P, action: F) -> R
Blocks until the predicate becomes true, then runs the action.
Source§fn 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 the action.
Source§impl<T: Default> Default for ArcMockMonitor<T>
impl<T: Default> Default for ArcMockMonitor<T>
Source§impl<T> Deref for ArcMockMonitor<T>
impl<T> Deref for ArcMockMonitor<T>
Source§impl<T> From<T> for ArcMockMonitor<T>
impl<T> From<T> for ArcMockMonitor<T>
Source§impl<T> NotificationWaiter for ArcMockMonitor<T>
impl<T> NotificationWaiter for ArcMockMonitor<T>
Source§impl<T> Notifier for ArcMockMonitor<T>
impl<T> Notifier for ArcMockMonitor<T>
Source§fn notify_one(&self)
fn notify_one(&self)
Wakes one waiter.
Source§fn notify_all(&self)
fn notify_all(&self)
Wakes all waiters.
Source§impl<T> TimeoutConditionWaiter for ArcMockMonitor<T>
impl<T> TimeoutConditionWaiter for ArcMockMonitor<T>
Source§fn 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 mock timeout expires.
Source§fn 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 mock timeout expires.
Source§impl<T> TimeoutNotificationWaiter for ArcMockMonitor<T>
impl<T> TimeoutNotificationWaiter for ArcMockMonitor<T>
Source§fn wait_for(&self, timeout: Duration) -> WaitTimeoutStatus
fn wait_for(&self, timeout: Duration) -> WaitTimeoutStatus
Blocks until notification or mock timeout.