[−][src]Module futures_test::task
Task related testing utilities.
This module provides utilities for creating test
Context
s,
Waker
s and
Spawn
implementations.
Test contexts:
noop_context
creates a context that ignores calls tocx.waker().wake_by_ref()
.panic_context
creates a context that panics whencx.waker().wake_by_ref()
is called.
Test wakers:
noop_waker
creates a waker that ignores calls towake
.panic_waker
creates a waker that panics whenwake
is called.new_count_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_waker_ref
,
panic_waker_ref
, noop_spawner_mut
and panic_spawner_mut
.
Structs
AwokenCount | Number of times the waker was awoken. |
NoopSpawner | An implementation of |
PanicSpawner | An implementation of |
RecordSpawner | An implementation of |
Functions
new_count_waker | Create a new |
noop_context | |
noop_spawner_mut | Get a reference to a singleton instance of |
noop_waker | Create a new [ |
noop_waker_ref | Get a static reference to a [ |
panic_context | |
panic_spawner_mut | Get a reference to a singleton instance of |
panic_waker | Create a new |
panic_waker_ref | Get a global reference to a
|