diff --git a/scripts/async.rn b/scripts/async.rn index ad7713f40..d9c491bcb 100644 --- a/scripts/async.rn +++ b/scripts/async.rn @@ -2,7 +2,7 @@ struct Timeout; async fn test(timeout, helpful_hint) { let request = http::get(`http://httpstat.us/200?sleep=${timeout}`); - let timeout = time::delay_for(time::Duration::from_secs(2)); + let timeout = time::sleep(time::Duration::from_secs(2)); let result = select { _ = timeout => Err(Timeout), diff --git a/scripts/book/async/async_http_concurrent.rn b/scripts/book/async/async_http_concurrent.rn index ef54bab62..9f07fad9a 100644 --- a/scripts/book/async/async_http_concurrent.rn +++ b/scripts/book/async/async_http_concurrent.rn @@ -4,7 +4,7 @@ struct Timeout; async fn request(timeout) { let request = http::get(`http://httpstat.us/200?sleep=${timeout}`); - let timeout = time::delay_for(time::Duration::from_secs(2)); + let timeout = time::sleep(time::Duration::from_secs(2)); let result = select { _ = timeout => Err(Timeout), diff --git a/scripts/book/async/async_http_timeout.rn b/scripts/book/async/async_http_timeout.rn index 99eeddee8..f00f5439a 100644 --- a/scripts/book/async/async_http_timeout.rn +++ b/scripts/book/async/async_http_timeout.rn @@ -2,7 +2,7 @@ struct Timeout; async fn request(timeout) { let request = http::get(`http://httpstat.us/200?sleep=${timeout}`); - let timeout = time::delay_for(time::Duration::from_secs(2)); + let timeout = time::sleep(time::Duration::from_secs(2)); let result = select { _ = timeout => Err(Timeout), diff --git a/scripts/book/loops/loop_forever.rn b/scripts/book/loops/loop_forever.rn index d2746c8e3..ea6f650bd 100644 --- a/scripts/book/loops/loop_forever.rn +++ b/scripts/book/loops/loop_forever.rn @@ -3,6 +3,6 @@ use time::Duration; pub async fn main() { loop { println("Hello forever!"); - time::delay_for(Duration::from_secs(1)).await; + time::sleep(Duration::from_secs(1)).await; } }