File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ pub async fn pending<T>() {
66 std:: future:: pending :: < T > ( ) . await ;
77}
88
9- /// A task which sleeps for a specified duration.
9+ /// Sleep for a specified duration.
1010pub async fn sleep ( duration : Duration ) {
1111 Delay :: new ( duration) . await ;
1212}
@@ -23,6 +23,10 @@ mod wasm {
2323 use gloo_timers:: future:: TimeoutFuture ;
2424 use web_time:: Duration ;
2525
26+ /// Execute a future or error on timeout, whichever comes first.
27+ ///
28+ /// # Errors
29+ /// Will return `Err` if the timeout occurs before the future is ready.
2630 pub async fn timeout < F , T > ( dur : Duration , f : F ) -> Result < T , TimeoutError >
2731 where
2832 F : Future < Output = T > ,
@@ -45,6 +49,10 @@ mod native {
4549 use futures_timer:: Delay ;
4650 use web_time:: Duration ;
4751
52+ /// Execute a future or error on timeout, whichever comes first.
53+ ///
54+ /// # Errors
55+ /// Will return `Err` if the timeout occurs before the future is ready.
4856 pub async fn timeout < F , T > ( dur : Duration , f : F ) -> Result < T , TimeoutError >
4957 where
5058 F : Future < Output = T > ,
You can’t perform that action at this time.
0 commit comments