1#![warn(missing_docs)]
16
17#![no_std]
18#![cfg_attr(feature = "cargo-clippy", allow(clippy::style))]
19
20#[allow(unused_imports)]
21extern crate alloc;
22#[cfg(not(feature = "no_std"))]
23extern crate std;
24
25use core::{time, future};
26
27#[macro_use]
28mod utils;
29pub mod oneshot;
30mod timed;
31mod interval;
32
33pub use oneshot::Oneshot;
34pub use timed::{Timed, Expired};
35pub use interval::Interval;
36
37pub fn timed<F: future::Future>(job: F, timeout: time::Duration) -> impl future::Future<Output=Result<F::Output, Expired<F, oneshot::Timer>>> {
39 unsafe {
40 Timed::platform_new_unchecked(job, timeout)
41 }
42}
43
44pub fn interval(interval: time::Duration) -> Interval<oneshot::Timer> {
46 Interval::platform_new(interval)
47}