1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
//! Task related testing utilities. //! //! This module provides utilities for creating test //! [`Waker`](futures_core::task::Waker)s and //! [`Spawn`](futures_core::task::Spawn) implementations. //! //! Test wakers: //! - [`noop_waker`] creates a waker that ignores calls to //! [`wake`](futures_core::task::Waker). //! - [`panic_waker`] creates a waker that panics when //! [`wake`](futures_core::task::Waker) is called. //! - [`new_count_waker`] creates a waker that increments a counter whenever //! [`wake`](futures_core::task::Waker) is called. //! //! Test spawners: //! - [`NoopSpawner`] ignores calls to //! [`spawn`](futures_core::task::Spawn::spawn) //! - [`PanicSpawner`] panics if [`spawn`](futures_core::task::Spawn::spawn) 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`]. mod noop_spawner; pub use self::noop_spawner::{noop_spawner_mut, NoopSpawner}; pub use futures_util::task::{noop_waker, noop_waker_ref}; mod panic_spawner; pub use self::panic_spawner::{panic_spawner_mut, PanicSpawner}; mod panic_waker; pub use self::panic_waker::{panic_waker, panic_waker_ref}; mod record_spawner; pub use self::record_spawner::RecordSpawner; mod wake_counter; pub use self::wake_counter::{AwokenCount, new_count_waker};