Struct tokio_mock_task::MockTask
source · pub struct MockTask { /* private fields */ }
Expand description
Mock task
A mock task is able to intercept and track notifications.
Implementations§
source§impl MockTask
impl MockTask
sourcepub fn enter<F, R>(&mut self, f: F) -> Rwhere
F: FnOnce() -> R,
pub fn enter<F, R>(&mut self, f: F) -> Rwhere
F: FnOnce() -> R,
Run a closure from the context of the task.
Any notifications resulting from the execution of the closure are tracked.
sourcepub fn is_notified(&self) -> bool
pub fn is_notified(&self) -> bool
Returns true
if the inner future has received a readiness notification
since the last call to enter
.
sourcepub fn notifier_ref_count(&self) -> usize
pub fn notifier_ref_count(&self) -> usize
Returns the number of references to the task notifier
The task itself holds a reference. The return value will never be zero.