1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use core::{task, time};
use core::future::Future;
use core::pin::Pin;

///Timer that never expires.
pub struct NeverTimer;

impl super::Oneshot for NeverTimer {
    fn new(_: time::Duration) -> Self {
        Self
    }

    fn is_ticking(&self) -> bool {
        true
    }

    fn is_expired(&self) -> bool {
        false
    }

    fn cancel(&mut self) {
    }

    fn restart(&mut self, _: &time::Duration, _: &task::Waker) {
    }
}

impl Future for NeverTimer {
    type Output = ();

    fn poll(self: Pin<&mut Self>, _: &mut task::Context) -> task::Poll<Self::Output> {
        task::Poll::Pending
    }
}