mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-27 00:00:12 +02:00
time: add wait alias to sleep (#3897)
This commit is contained in:
@@ -57,6 +57,7 @@ pub fn sleep_until(deadline: Instant) -> Sleep {
|
|||||||
/// [`interval`]: crate::time::interval()
|
/// [`interval`]: crate::time::interval()
|
||||||
// Alias for old name in 0.x
|
// Alias for old name in 0.x
|
||||||
#[cfg_attr(docsrs, doc(alias = "delay_for"))]
|
#[cfg_attr(docsrs, doc(alias = "delay_for"))]
|
||||||
|
#[cfg_attr(docsrs, doc(alias = "wait"))]
|
||||||
pub fn sleep(duration: Duration) -> Sleep {
|
pub fn sleep(duration: Duration) -> Sleep {
|
||||||
match Instant::now().checked_add(duration) {
|
match Instant::now().checked_add(duration) {
|
||||||
Some(deadline) => sleep_until(deadline),
|
Some(deadline) => sleep_until(deadline),
|
||||||
|
|||||||
Reference in New Issue
Block a user