Expand description

Task related testing utilities.

This module provides utilities for creating test Contexts, Wakers and Spawn implementations.

Test contexts:

Test wakers:

Test spawners:

For convenience there additionally exist various functions that directly return waker/spawner references: noop_waker_ref, panic_waker_ref, noop_spawner_mut and panic_spawner_mut.

Structs

Number of times the waker was awoken.

An implementation of Spawn that discards spawned futures when used.

An implementation of Spawn that panics when used.

An implementation of Spawn that records any Futures spawned on it.

Functions

Create a new Waker that counts the number of times it’s awoken.

Create a new Context where the waker will ignore any uses.

Get a reference to a singleton instance of NoopSpawner.

Create a new Waker which does nothing when wake() is called on it.

Get a static reference to a Waker which does nothing when wake() is called on it.

Create a new Context where the waker will panic if used.

Get a reference to a singleton instance of PanicSpawner.

Create a new Waker which will panic when wake() is called on it. The Waker can be converted into a Waker which will behave the same way.

Get a global reference to a Waker referencing a singleton instance of a Waker which panics when woken.