forked from mirror/async-std
Rename 'task' variable in example
The collision between the 'task' variable and the 'task' import is confusing (task::block_on(task) especially).
This commit is contained in:
parent
7e5ff9409b
commit
77171b5f45
1 changed files with 2 additions and 2 deletions
|
@ -15,7 +15,7 @@ async fn read_file(path: &str) -> Result<String, io::Error> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let task = task::spawn(async {
|
let reader_task = task::spawn(async {
|
||||||
let result = read_file("data.csv");
|
let result = read_file("data.csv");
|
||||||
match result {
|
match result {
|
||||||
Ok(s) => println!("{}", s),
|
Ok(s) => println!("{}", s),
|
||||||
|
@ -23,7 +23,7 @@ fn main() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
println!("Started task!");
|
println!("Started task!");
|
||||||
task::block_on(task);
|
task::block_on(reader_task);
|
||||||
println!("Stopped task!");
|
println!("Stopped task!");
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in a new issue