mygit

[UNMAINTAINED] A cgit/webgit alternative, written in Rust
Log | Files | Refs | README | LICENSE

commit c02dd6deb0c13dfa36d3e8ffe813d9c0624a4a8b
parent 202bdd57170c8d940719fb6d4f46b8eb0b770e0b
Author: Johann150 <johann@qwertqwefsday.eu>
Date:   Sun, 21 Mar 2021 16:55:12 +0100

remove dead code

Diffstat:
Dsrc/templates.rs | 32--------------------------------
1 file changed, 0 insertions(+), 32 deletions(-)

diff --git a/src/templates.rs b/src/templates.rs @@ -1,32 +0,0 @@ -pub use askama; -pub use tide; - -use askama::*; -use tide::{http::Mime, Body, Response}; - -pub fn try_into_body<T: Template>(t: &T, ext: &str) -> Result<Body> { - let string = t.render()?; - let mut body = Body::from_string(string); - - if let Some(mime) = Mime::from_extension(ext) { - body.set_mime(mime); - } - - Ok(body) -} - -pub fn into_response<T: Template>(t: &T, ext: &str) -> Response { - match try_into_body(t, ext) { - Ok(body) => { - let mut response = Response::new(200); - response.set_body(body); - response - } - - Err(error) => { - let mut response = Response::new(500); - response.set_error(error); - response - } - } -}