💾 Archived View for lists.flounder.online › patches › threads › 20210321155513.1389-2-johann@qwertqw… captured on 2022-04-28 at 19:24:37. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
From: johann@qwertqwefsday.eu
Date: Sun, 21 Mar 2021 16:55:12 +0100
Message-Id: 20210321155513.1389-2-johann@qwertqwefsday.eu
To: <~aw/patches@lists.sr.ht>
In-Reply-To: 20210321155513.1389-1-johann@qwertqwefsday.eu
Cc: "Johann150" <johann@qwertqwefsday.eu>
--------------------------------------
From: Johann150 <johann@qwertqwefsday.eu>
---
src/templates.rs | 32 --------------------------------
1 file changed, 32 deletions(-)
delete mode 100644 src/templates.rs
diff --git a/src/templates.rs b/src/templates.rs
deleted file mode 100644
index 59f90e9..0000000
--- a/src/templates.rs
+++ /dev/null
@@ -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
- }
- }
-}
--
2.20.1