mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-19 00:00:09 +02:00
timer: Rename sleep to delay_for, reexport from tokio (#1518)
This commit is contained in:
committed by
Carl Lerche
parent
6a94d2cf4f
commit
d2bd6f5002
@@ -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
@@ -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,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user