error[E0277]: the ? operator can only be used in a function that returns Result or Option (or another type that implements FromResidual)
--> src/main.rs:19:76
|
14 | fn main() {
| --------- this function should return Result or Option to accept ?
...
19 | let mut rdr= ReaderBuilder::new().has_headers(true).from_path(csv_path)?;
| ^ cannot use the ? operator in a function that returns ()
|
= help: the trait FromResidual<Result<Infallible, csv::Error>> is not implemented for ()
help: consider adding return type
|
14 ~ fn main() -> Result<(), Box<dyn std::error::Error>> {
15 |
...
53 | println!("Predictions: {:?}", predictions);
54 + Ok(())
|
error[E0277]: the ? operator can only be used in a function that returns Result or Option (or another type that implements FromResidual)
--> src/main.rs:25:43
|
14 | fn main() {
| --------- this function should return Result or Option to accept ?
...
25 | let record: StringRecord = result?;
| ^ cannot use the ? operator in a function that returns ()
|
= help: the trait FromResidual<Result<Infallible, csv::Error>> is not implemented for ()
help: consider adding return type
|
14 ~ fn main() -> Result<(), Box<dyn std::error::Error>> {
15 |
...
53 | println!("Predictions: {:?}", predictions);
54 + Ok(())
|
For more information about this error, try rustc --explain E0277.