Skip to content

Commit adcf682

Browse files
fkohlgrueberkoute
authored andcommitted
fix futures example to work with current nightly (2019-08-18)
1 parent cc96683 commit adcf682

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

examples/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[workspace]
2-
members = ["canvas", "drag", "echo", "gamepad", "hasher", "minimal", "todomvc", "webgl", "wasm-bindgen-minimal"]
2+
members = ["canvas", "drag", "echo", "futures", "gamepad", "hasher", "minimal", "todomvc", "webgl", "wasm-bindgen-minimal"]

examples/futures/src/main.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(async_await, await_macro)]
1+
#![feature(async_await)]
22

33
#[macro_use]
44
extern crate stdweb;
@@ -24,32 +24,32 @@ fn javascript_promise() -> PromiseFuture< u32 > {
2424

2525
async fn print( message: &str ) {
2626
// Waits for 2000 milliseconds
27-
await!( wait( 2000 ) );
27+
wait( 2000 ).await;
2828
console!( log, message );
2929
}
3030

3131

3232
async fn future_main() -> Result< (), Error > {
3333
// Runs Futures synchronously
34-
await!( print( "Hello" ) );
35-
await!( print( "There" ) );
34+
print( "Hello" ).await;
35+
print( "There" ).await;
3636

3737
{
3838
// Runs multiple Futures in parallel
39-
let ( a, b ) = await!( join(
39+
let ( a, b ) = join(
4040
print( "Test 1" ),
4141
print( "Test 2" ),
42-
) );
42+
).await;
4343

4444
console!( log, "join", a, b );
4545
}
4646

4747
{
4848
// Runs multiple Futures (which can error) in parallel
49-
let ( a, b ) = await!( try_join(
49+
let ( a, b ) = try_join(
5050
javascript_promise(),
5151
javascript_promise(),
52-
) )?;
52+
).await?;
5353

5454
console!( log, "try_join", a, b );
5555
}

0 commit comments

Comments
 (0)