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

1026
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -19,15 +19,15 @@ semver = "0.11"
uuid = { version = "0.7", features = ["serde", "v4"] }
duplicate = "0.2"
bincode = "1"
handlebars = "1"
handlebars = "3"
[dependencies.rocket]
version = "0.4"
#git = "https://github.com/SergioBenitez/Rocket"
#branch = "master"
#version = "0.4"
git = "https://github.com/SergioBenitez/Rocket"
branch = "master"
[dependencies.rocket_contrib]
version = "0.4"
#git = "https://github.com/SergioBenitez/Rocket"
#branch = "master"
#version = "0.4"
git = "https://github.com/SergioBenitez/Rocket"
branch = "master"
features = ["handlebars_templates", "uuid"]

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\