File tree 2 files changed +16
-13
lines changed
2 files changed +16
-13
lines changed Original file line number Diff line number Diff line change @@ -8,13 +8,16 @@ license = "MIT"
8
8
repository = " https://github.com/tomaka/wasm-timer"
9
9
10
10
[dependencies ]
11
- futures-preview = " 0.3.0-alpha "
11
+ futures = " 0.3.1 "
12
12
parking_lot = " 0.9"
13
13
pin-utils = " 0.1.0-alpha.4"
14
14
15
15
[target .'cfg(all(target_arch = "wasm32", target_os = "unknown"))' .dependencies ]
16
- js-sys = " 0.3.14 "
16
+ js-sys = " 0.3.31 "
17
17
send_wrapper = " 0.2"
18
- wasm-bindgen = { version = " 0.2.37" }
19
- wasm-bindgen-futures = { version = " 0.3.25" , features = [" futures_0_3" ] }
20
- web-sys = { version = " 0.3.14" , features = [" Performance" , " Window" ] }
18
+ wasm-bindgen = " 0.2.37"
19
+ wasm-bindgen-futures = " 0.4.4"
20
+ web-sys = { version = " 0.3.31" , features = [" Performance" , " Window" ] }
21
+
22
+ [dev-dependencies ]
23
+ async-std = " 1.0"
Original file line number Diff line number Diff line change @@ -27,24 +27,24 @@ pub trait TryFutureExt: TryFuture + Sized {
27
27
/// # Examples
28
28
///
29
29
/// ```no_run
30
- /// # #![feature(async_await)]
31
30
/// use std::time::Duration;
32
31
/// use futures::prelude::*;
33
- /// use futures_timer ::TryFutureExt;
32
+ /// use wasm_timer ::TryFutureExt;
34
33
///
35
34
/// # fn long_future() -> impl TryFuture<Ok = (), Error = std::io::Error> {
36
35
/// # futures::future::ok(())
37
36
/// # }
38
37
/// #
39
- /// #[runtime::main]
40
- /// async fn main() {
38
+ /// fn main() {
41
39
/// let future = long_future();
42
40
/// let timed_out = future.timeout(Duration::from_secs(1));
43
41
///
44
- /// match timed_out.await {
45
- /// Ok(item) => println!("got {:?} within enough time!", item),
46
- /// Err(_) => println!("took too long to produce the item"),
47
- /// }
42
+ /// async_std::task::block_on(async {
43
+ /// match timed_out.await {
44
+ /// Ok(item) => println!("got {:?} within enough time!", item),
45
+ /// Err(_) => println!("took too long to produce the item"),
46
+ /// }
47
+ /// })
48
48
/// }
49
49
/// ```
50
50
fn timeout ( self , dur : Duration ) -> Timeout < Self >
You can’t perform that action at this time.
0 commit comments