|
|
|
@ -17,7 +17,7 @@ async fn read_file(path: &str) -> Result<String, io::Error> {
|
|
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
|
let reader_task = task::spawn(async {
|
|
|
|
|
let result = read_file("data.csv");
|
|
|
|
|
let result = read_file("data.csv").await;
|
|
|
|
|
match result {
|
|
|
|
|
Ok(s) => println!("{}", s),
|
|
|
|
|
Err(e) => println!("Error reading file: {:?}", e)
|
|
|
|
@ -33,7 +33,7 @@ This asks the runtime baked into `async_std` to execute the code that reads a fi
|
|
|
|
|
|
|
|
|
|
```rust
|
|
|
|
|
async {
|
|
|
|
|
let result = read_file("data.csv");
|
|
|
|
|
let result = read_file("data.csv").await;
|
|
|
|
|
match result {
|
|
|
|
|
Ok(s) => println!("{}", s),
|
|
|
|
|
Err(e) => println!("Error reading file: {:?}", e)
|
|
|
|
|