From 968dcbdb56a8d619437464c086f00e2d867901b4 Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Thu, 8 Jul 2021 23:43:13 +0200 Subject: [PATCH] Fix no main found --- src/main.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index 2e36c6d..5c2a48b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -18,9 +18,9 @@ async fn run_migrations(rocket: Rocket) -> Rocket { rocket } -#[launch] -fn rocket() -> _ { - rocket::build() +#[rocket::main] +async fn main() { + let rocket_builder = rocket::build() .mount("/", routes![ controllers::tasks_controller::index_template ]) @@ -37,5 +37,11 @@ fn rocket() -> _ { ]) .attach(DbConn::fairing()) .attach(Template::fairing()) - .attach(AdHoc::on_ignite("Run Migrations", run_migrations)) + .attach(AdHoc::on_ignite("Run Migrations", run_migrations)); + + if let Err(e) = rocket_builder.launch().await { + println!("Whoops! Rocket didn't launch!"); + // We drop the error to get a Rocket-formatted panic. + drop(e); + }; }