Update rocket to 0.5

This commit is contained in:
2020-11-12 23:37:21 +01:00
parent af434f0bc0
commit fdab612863
4 changed files with 636 additions and 414 deletions

View File

@ -1,4 +1,3 @@
#![feature(decl_macro)]
mod database;
mod handlebars_util;
mod routes;
@ -13,7 +12,8 @@ use rocket_contrib::serve::StaticFiles;
use rocket_contrib::templates::Template;
use std::{env, io};
fn main() -> io::Result<()> {
#[rocket::main]
async fn main() -> io::Result<()> {
dotenv().ok();
let db_path = env::var("DB_PATH").expect("DB_PATH not set");
@ -59,7 +59,7 @@ fn main() -> io::Result<()> {
],
);
rocket.launch();
rocket.launch().await.expect("rocket failed to launch");
Ok(())
}

View File

@ -37,8 +37,8 @@ impl StatusJson {
}
}
impl<'r> Responder<'r> for StatusJson {
fn respond_to(self, req: &Request) -> Result<Response<'r>, Status> {
impl<'r> Responder<'r, 'static> for StatusJson {
fn respond_to(self, req: &Request) -> Result<Response<'static>, Status> {
if self.status.code >= 400 {
warn!(
"Responding with status {}.\n\