I've tried replacing Result<()>
with Result<(), std::io::Error>
But it results in: more errors.
Error:
error[E0277]: `?` couldn't convert the error to `std::io::Error`
--> src/main.rs:48:53
|
48 | let conn = rusqlite::Connection::open("data.db")?;
| ^ the trait `std::convert::From<rusqlite::Error>` is not implemented for `std::io::Error`
|
= note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
= help: the following other types implement trait `std::convert::From<T>`:
<std::io::Error as std::convert::From<ErrorKind>>
<std::io::Error as std::convert::From<IntoInnerError<W>>>
<std::io::Error as std::convert::From<JoinError>>
<std::io::Error as std::convert::From<flate2::mem::CompressError>>
<std::io::Error as std::convert::From<flate2::mem::DecompressError>>
<std::io::Error as std::convert::From<getrandom::error::Error>>
<std::io::Error as std::convert::From<httpdate::Error>>
<std::io::Error as std::convert::From<rand_core::error::Error>>
and 5 others
= note: required for `Result<(), std::io::Error>` to implement `FromResidual<Result<Infallible, rusqlite::Error>>`
my code:
#[actix_web::main]
async fn main() -> std::io::Result<()> {
let conn = rusqlite::Connection::open("data.db")?;
conn.execute(r#"
CREATE TABLE IF NOT EXISTS user (
usid INT,
name VARCHAR(256),
pass VARCHAR(512),
mail VARCHAR(256)
)
"#, [])?;
HttpServer::new(|| {
App::new()
.service(_main)
// ... Multiple Other Services
.bind(("127.0.0.1", 8080))?
.run()
.await
}