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"] } uuid = { version = "0.7", features = ["serde", "v4"] }
duplicate = "0.2" duplicate = "0.2"
bincode = "1" bincode = "1"
handlebars = "1" handlebars = "3"
[dependencies.rocket] [dependencies.rocket]
version = "0.4" #version = "0.4"
#git = "https://github.com/SergioBenitez/Rocket" git = "https://github.com/SergioBenitez/Rocket"
#branch = "master" branch = "master"
[dependencies.rocket_contrib] [dependencies.rocket_contrib]
version = "0.4" #version = "0.4"
#git = "https://github.com/SergioBenitez/Rocket" git = "https://github.com/SergioBenitez/Rocket"
#branch = "master" branch = "master"
features = ["handlebars_templates", "uuid"] features = ["handlebars_templates", "uuid"]

View File

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

View File

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