From ecc0ff7bf3f05ce11f59ce25f5c262905d594b9b Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sun, 3 Mar 2019 10:41:22 +0100 Subject: Enable askama rocket integration. Let's us return templates directly, and have rocket render it for us. --- src/main.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index 307bbc4..1ee6011 100644 --- a/src/main.rs +++ b/src/main.rs @@ -22,10 +22,7 @@ use rocket::{ get, http::RawStr, routes, - response::{ - NamedFile, - content::Html, - }, + response::NamedFile, }; use std::path::PathBuf; @@ -36,9 +33,8 @@ struct IndexTemplate<'a> { } #[get("/")] -fn index<'a>() -> Html { - let t = IndexTemplate { year: "2019" }; - Html(t.render().unwrap()) +fn index<'a>() -> IndexTemplate<'static> { + IndexTemplate { year: "2019" } } #[get("/", rank = 99)] -- cgit v1.2.3