[−][src]Module futures_test::task
Task related testing utilities.
This module provides utilities for creating test
task::Context
s,
LocalWaker
s and
Spawn
implementations.
Commonly needed task::Context
s can be
created via the functions no_spawn_context
,
noop_context
and panic_context
. For more advanced use cases, you
can create your own task context via
task::Context::new
and make use
of the various provided test wakers and spawners:
Test wakers:
noop_local_waker
creates a waker that ignores calls towake
.panic_local_waker
creates a waker that panics whenwake
is called.WakeCounter::local_waker
creates a waker that increments a counter wheneverwake
is called.
Test spawners:
NoopSpawner
ignores calls tospawn
PanicSpawner
panics ifspawn
is called.RecordSpawner
records the spawned futures.
For convenience there additionally exist various functions that directly
return waker/spawner references: noop_local_waker_ref
,
panic_local_waker_ref
, noop_spawner_mut
and panic_spawner_mut
.
Structs
NoopSpawner |
An implementation of |
NoopWake |
An implementation of |
PanicSpawner |
An implementation of |
PanicWake |
An implementation of |
RecordSpawner |
An implementation of |
WakeCounter |
An implementation of |
Functions
no_spawn_context |
Create a new |
noop_context |
Create a new |
noop_local_waker |
Create a new |
noop_local_waker_ref |
Get a thread local reference to a
|
noop_spawner_mut |
Get a reference to a singleton instance of |
panic_context |
Create a new |
panic_local_waker |
Create a new |
panic_local_waker_ref |
Get a thread local reference to a
|
panic_spawner_mut |
Get a reference to a singleton instance of |