From 1431ee04220bd3292f38a913523e4b432997a41b Mon Sep 17 00:00:00 2001 From: Yoshua Wuyts Date: Tue, 12 Nov 2019 23:25:52 +0100 Subject: [PATCH] polish README.md examples Signed-off-by: Yoshua Wuyts --- README.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 9af20a3..3c074fe 100644 --- a/README.md +++ b/README.md @@ -75,19 +75,21 @@ syntax. ## Examples ```rust -use async_std::task; +async fn say_hello() { + println!("Hello, world!"); +} -fn main() { - task::block_on(async { - println!("Hello, world!"); - }) +#[async_std::main] +async fn main() { + say_hello().await; } ``` More examples, including networking and file access, can be found in our -[`examples`] directory. +[`examples`] directory and in our [documentation]. [`examples`]: https://github.com/async-rs/async-std/tree/master/examples +[documentation]: https://docs.rs/async-std#examples ## Philosophy