mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-09-28 12:10:37 +00:00
timer: add sleep free function (#347)
This commit is contained in:
parent
a850063211
commit
88801bb613
@ -34,8 +34,15 @@ mod delay;
|
||||
mod error;
|
||||
mod interval;
|
||||
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
pub use self::deadline::{Deadline, DeadlineError};
|
||||
pub use self::delay::Delay;
|
||||
pub use self::error::Error;
|
||||
pub use self::interval::Interval;
|
||||
pub use self::timer::{Timer, with_default};
|
||||
pub use self::timer::{with_default, Timer};
|
||||
|
||||
/// Create a Future that completes in `duration` from now.
|
||||
pub fn sleep(duration: Duration) -> Delay {
|
||||
Delay::new(Instant::now() + duration)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user