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
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
use core::{task, time};
use core::marker::Unpin;
use core::future::Future;
pub trait Oneshot: Send + Sync + Unpin + Future<Output=()> {
    
    
    
    fn new(timeout: time::Duration) -> Self;
    
    
    
    
    fn is_ticking(&self) -> bool;
    
    fn is_expired(&self) -> bool;
    
    fn cancel(&mut self);
    
    
    
    fn restart(&mut self, timeout: &time::Duration, waker: &task::Waker);
}
mod state;
#[cfg(target_arch = "wasm32")]
pub mod web;
#[cfg(windows)]
pub mod win;
#[cfg(any(target_os = "linux", target_os = "android", target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd"))]
pub mod posix;
#[cfg(any(target_os = "macos", target_os = "ios"))]
pub mod apple;
#[cfg(all(feature = "romio_on", any(target_os = "linux", target_os = "android")))]
pub mod timer_fd;
#[cfg(all(feature = "romio_on", any(target_os = "bitrig", target_os = "dragonfly", target_os = "freebsd", target_os = "ios", target_os = "macos", target_os = "netbsd", target_os = "openbsd")))]
pub mod kqueue;
#[cfg(not(any(
windows, target_arch = "wasm32", target_os = "linux", target_os = "android", target_os = "macos", target_os = "ios", target_os="freebsd", target_os="netbsd", target_os = "openbsd", target_os="dragonfly",
all(feature = "romio_on", any(target_os = "bitrig", target_os = "ios", target_os = "macos"))
)))]
pub mod dummy;
mod extra;
pub use extra::NeverTimer;
#[cfg(all(feature = "romio_on", any(target_os = "linux", target_os = "android")))]
pub use timer_fd::TimerFd;
#[cfg(target_arch = "wasm32")]
pub type Timer = web::WebTimer;
#[cfg(windows)]
pub type Timer = win::WinTimer;
#[cfg(all(not(feature = "romio_on"), any(target_os = "linux", target_os = "android", target_os = "dragonfly", target_os = "netbsd", target_os="freebsd", target_os = "openbsd")))]
pub type Timer = posix::PosixTimer;
#[cfg(all(feature = "romio_on", any(target_os = "linux", target_os = "android")))]
pub type Timer = timer_fd::TimerFd;
#[cfg(all(not(feature = "romio_on"), any(target_os = "macos", target_os = "ios")))]
pub type Timer = apple::AppleTimer;
#[cfg(all(feature = "romio_on", any(target_os = "bitrig", target_os = "dragonfly", target_os = "freebsd", target_os = "ios", target_os = "macos", target_os = "netbsd", target_os = "openbsd")))]
pub type Timer = kqueue::KqueueTimer;
#[cfg(not(any(
windows, target_arch = "wasm32", target_os = "linux", target_os = "android", target_os = "macos", target_os = "ios", target_os="freebsd", target_os="netbsd", target_os = "openbsd", target_os="dragonfly",
all(feature = "romio_on", any(target_os = "bitrig", target_os = "ios", target_os = "macos"))
)))]
pub type Timer = dummy::DummyTimer;