跳到主要内容

AsyncTimer

搜索

trait AsyncTimer 

源代码
pub trait AsyncTimer:
    Send
    + Debug
    + 'static {
    // Required methods
    fn reset(self: Pin<&mut Self>, i: Instant);
    fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<()>;
}
展开描述

异步定时器的抽象实现,用于运行时无关性

必需方法§

源代码

fn reset(self: Pin<&mut Self>, i: Instant)

将定时器更新为在 i 时刻触发

源代码

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

检查定时器是否已到期;若尚未到期则注册为等待唤醒

Implementations on Foreign Types§

源代码§

impl AsyncTimer for Sleep

源代码§

fn reset(self: Pin<&mut Self>, t: Instant)

源代码§

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

实现者§