Skip to main content

Timeslicer

Trait Timeslicer 

Source
pub trait Timeslicer {
    // Required methods
    fn sleep(&self, duration: Duration) -> impl Future<Output = ()>;
    fn yield_now(&self) -> impl Future<Output = ()>;
}
Expand description

Async runtime integration for yielding and sleeping.

Required Methods§

Source

fn sleep(&self, duration: Duration) -> impl Future<Output = ()>

Sleep for the provided duration.

Source

fn yield_now(&self) -> impl Future<Output = ()>

Yield to the async scheduler.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§