Skip to main content

Sleeper

Trait Sleeper 

Source
pub trait Sleeper {
    // Required methods
    fn snooze(self: Pin<&mut Self>, duration: Duration) -> bool;
    fn poll_sleep(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<()>;
}
Expand description

A dyn-compatible interface for polling one sleep Future at a time.

Required Methods§

Source

fn snooze(self: Pin<&mut Self>, duration: Duration) -> bool

Source

fn poll_sleep(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<()>

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§