[][src]Struct tokio_test::task::MockTask

pub struct MockTask { /* fields omitted */ }

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]

Poll a future

pub fn enter<F, R>(&mut self, f: F) -> R where
    F: FnOnce(&mut Context) -> R, 
[src]

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 Clone for MockTask[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Default for MockTask[src]

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]