pub trait SleepCapability: Clone + Debug {
// Required methods
fn new() -> Self;
fn sleep(&self, duration: Duration) -> impl Future<Output = ()> + MaybeSend;
}Required Methods§
Sourcefn new() -> Self
fn new() -> Self
Construct a new sleeper.
Stateless impls return a unit struct; stateful impls (mock clocks,
virtual time sources, etc.) should return a sensible default. Callers
that don’t have an instance handy can use the static-style
C::new().sleep(duration) pattern, mirroring HttpClientCapability’s
new_client() + request(&self) shape.
fn sleep(&self, duration: Duration) -> impl Future<Output = ()> + MaybeSend
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.