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.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MockTask
impl RefUnwindSafe for MockTask
impl Send for MockTask
impl Sync for MockTask
impl Unpin for MockTask
impl UnwindSafe for MockTask
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more