pub trait Sleeper:
Send
+ Sync
+ Debug {
// Required method
fn sleep<'life0, 'async_trait>(
&'life0 self,
duration: Duration,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
The one way anything in this crate waits.
A port rather than a direct tokio::time::sleep, for the same reason the
domain has a Clock: the device flow’s slow_down handling is a timing
behaviour, and a timing behaviour tested by actually waiting is either
untested or slow. A test substitutes a sleeper that records the requested
durations and returns immediately, which turns “slow_down increases the
poll interval” into an equality assertion on a Vec<Duration> rather than a
stopwatch reading.
Required Methods§
fn sleep<'life0, 'async_trait>(
&'life0 self,
duration: Duration,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".