timer: Rename sleep to delay_for, reexport from tokio (#1518)

This commit is contained in:
Benjamin Saunders
2019-08-30 10:23:54 -07:00
committed by Carl Lerche
parent 6a94d2cf4f
commit d2bd6f5002
2 changed files with 6 additions and 2 deletions
+3 -1
View File
@@ -64,7 +64,9 @@ pub fn delay(deadline: Instant) -> Delay {
}
/// Create a Future that completes in `duration` from now.
pub fn sleep(duration: Duration) -> Delay {
///
/// Equivalent to `delay(Instant::now() + duration)`. Analogous to `std::thread::sleep`.
pub fn delay_for(duration: Duration) -> Delay {
delay(Instant::now() + duration)
}
+3 -1
View File
@@ -75,4 +75,6 @@
//! [Interval]: struct.Interval.html
//! [`DelayQueue`]: struct.DelayQueue.html
pub use tokio_timer::{delay, delay_queue, timeout, Delay, DelayQueue, Error, Interval, Timeout};
pub use tokio_timer::{
delay, delay_for, delay_queue, timeout, Delay, DelayQueue, Error, Interval, Timeout,
};