forked from mirror/async-std
fix readme
This commit is contained in:
parent
9311fd7fae
commit
a04157850b
1 changed files with 4 additions and 7 deletions
11
README.md
11
README.md
|
@ -74,18 +74,15 @@ syntax.
|
|||
|
||||
## Examples
|
||||
|
||||
All examples require the [`"attributes"` feature] to be enabled. This feature
|
||||
is not enabled by default because it significantly impacts compile times. See
|
||||
[`task::block_on`] for an alternative way to start executing tasks.
|
||||
|
||||
```rust
|
||||
use async_std::task;
|
||||
|
||||
async fn say_hello() {
|
||||
println!("Hello, world!");
|
||||
}
|
||||
|
||||
#[async_std::main]
|
||||
async fn main() {
|
||||
say_hello().await;
|
||||
fn main() {
|
||||
task::block_on(say_hello())
|
||||
}
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in a new issue