Skip to content

Commit 1431ee0

Browse files
committed
polish README.md examples
Signed-off-by: Yoshua Wuyts <[email protected]>
1 parent 2dfdc1c commit 1431ee0

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

README.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -75,19 +75,21 @@ syntax.
7575
## Examples
7676

7777
```rust
78-
use async_std::task;
78+
async fn say_hello() {
79+
println!("Hello, world!");
80+
}
7981

80-
fn main() {
81-
task::block_on(async {
82-
println!("Hello, world!");
83-
})
82+
#[async_std::main]
83+
async fn main() {
84+
say_hello().await;
8485
}
8586
```
8687

8788
More examples, including networking and file access, can be found in our
88-
[`examples`] directory.
89+
[`examples`] directory and in our [documentation].
8990

9091
[`examples`]: https://github.com/async-rs/async-std/tree/master/examples
92+
[documentation]: https://docs.rs/async-std#examples
9193

9294
## Philosophy
9395

0 commit comments

Comments
 (0)