[−][src]Struct tokio_test::task::MockTask
Mock task
A mock task is able to intercept and track wake notifications.
Methods
impl MockTask
[src]
pub fn new() -> Self
[src]
Create a new mock task
pub fn poll<T, F>(&mut self, fut: T) -> Poll<F::Output> where
T: AsPinMut<F>,
F: Future,
[src]
T: AsPinMut<F>,
F: Future,
Poll a future
pub fn enter<F, R>(&mut self, f: F) -> R where
F: FnOnce(&mut Context) -> R,
[src]
F: FnOnce(&mut Context) -> R,
Run a closure from the context of the task.
Any wake notifications resulting from the execution of the closure are tracked.
pub fn is_woken(&self) -> bool
[src]
Returns true
if the inner future has received a wake notification
since the last call to enter
.
pub fn waker_ref_count(&self) -> usize
[src]
Returns the number of references to the task waker
The task itself holds a reference. The return value will never be zero.
Trait Implementations
impl Default for MockTask
[src]
impl Clone for MockTask
[src]
fn clone(&self) -> MockTask
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for MockTask
[src]
Auto Trait Implementations
impl Send for MockTask
impl Unpin for MockTask
impl Sync for MockTask
impl !UnwindSafe for MockTask
impl !RefUnwindSafe for MockTask
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,