source:
doc/papers/llheap/examples/future.rs@
c0035fc
| Last change on this file since c0035fc was 7bef8cf, checked in by , 2 years ago | |
|---|---|
|
|
| File size: 233 bytes | |
| Line | |
|---|---|
| 1 | use futures::executor::block_on; |
| 2 | |
| 3 | async fn hello_world() { |
| 4 | println!("hello, world!"); |
| 5 | } |
| 6 | |
| 7 | fn main() { |
| 8 | let future = hello_world(); // Nothing is printed |
| 9 | block_on(future); // `future` is run and "hello, world!" is printed |
| 10 | } |
Note:
See TracBrowser
for help on using the repository browser.