mirror of
https://github.com/fluencelabs/wasm-timer
synced 2025-03-15 16:20:49 +00:00
Update to futures-0.3
This commit is contained in:
parent
10a791e323
commit
99c3a61a76
13
Cargo.toml
13
Cargo.toml
@ -8,13 +8,16 @@ license = "MIT"
|
|||||||
repository = "https://github.com/tomaka/wasm-timer"
|
repository = "https://github.com/tomaka/wasm-timer"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
futures-preview = "0.3.0-alpha"
|
futures = "0.3.1"
|
||||||
parking_lot = "0.9"
|
parking_lot = "0.9"
|
||||||
pin-utils = "0.1.0-alpha.4"
|
pin-utils = "0.1.0-alpha.4"
|
||||||
|
|
||||||
[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies]
|
[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies]
|
||||||
js-sys = "0.3.14"
|
js-sys = "0.3.31"
|
||||||
send_wrapper = "0.2"
|
send_wrapper = "0.2"
|
||||||
wasm-bindgen = { version = "0.2.37" }
|
wasm-bindgen = "0.2.37"
|
||||||
wasm-bindgen-futures = { version = "0.3.25", features = ["futures_0_3"] }
|
wasm-bindgen-futures = "0.4.4"
|
||||||
web-sys = { version = "0.3.14", features = ["Performance", "Window"] }
|
web-sys = { version = "0.3.31", features = ["Performance", "Window"] }
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
async-std = "1.0"
|
||||||
|
@ -27,24 +27,24 @@ pub trait TryFutureExt: TryFuture + Sized {
|
|||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```no_run
|
/// ```no_run
|
||||||
/// # #![feature(async_await)]
|
|
||||||
/// use std::time::Duration;
|
/// use std::time::Duration;
|
||||||
/// use futures::prelude::*;
|
/// use futures::prelude::*;
|
||||||
/// use futures_timer::TryFutureExt;
|
/// use wasm_timer::TryFutureExt;
|
||||||
///
|
///
|
||||||
/// # fn long_future() -> impl TryFuture<Ok = (), Error = std::io::Error> {
|
/// # fn long_future() -> impl TryFuture<Ok = (), Error = std::io::Error> {
|
||||||
/// # futures::future::ok(())
|
/// # futures::future::ok(())
|
||||||
/// # }
|
/// # }
|
||||||
/// #
|
/// #
|
||||||
/// #[runtime::main]
|
/// fn main() {
|
||||||
/// async fn main() {
|
|
||||||
/// let future = long_future();
|
/// let future = long_future();
|
||||||
/// let timed_out = future.timeout(Duration::from_secs(1));
|
/// let timed_out = future.timeout(Duration::from_secs(1));
|
||||||
///
|
///
|
||||||
/// match timed_out.await {
|
/// async_std::task::block_on(async {
|
||||||
/// Ok(item) => println!("got {:?} within enough time!", item),
|
/// match timed_out.await {
|
||||||
/// Err(_) => println!("took too long to produce the item"),
|
/// Ok(item) => println!("got {:?} within enough time!", item),
|
||||||
/// }
|
/// Err(_) => println!("took too long to produce the item"),
|
||||||
|
/// }
|
||||||
|
/// })
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
fn timeout(self, dur: Duration) -> Timeout<Self>
|
fn timeout(self, dur: Duration) -> Timeout<Self>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user