async_timer/oneshot/
extra.rs

1use core::{task, time};
2use core::future::Future;
3use core::pin::Pin;
4
5///Timer that never expires.
6pub struct NeverTimer;
7
8impl super::Oneshot for NeverTimer {
9    fn new(_: time::Duration) -> Self {
10        Self
11    }
12
13    fn is_ticking(&self) -> bool {
14        true
15    }
16
17    fn is_expired(&self) -> bool {
18        false
19    }
20
21    fn cancel(&mut self) {
22    }
23
24    fn restart(&mut self, _: time::Duration, _: &task::Waker) {
25    }
26}
27
28impl Future for NeverTimer {
29    type Output = ();
30
31    fn poll(self: Pin<&mut Self>, _: &mut task::Context) -> task::Poll<Self::Output> {
32        task::Poll::Pending
33    }
34}