aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2019-01-10 22:12:56 +0100
committerLibravatar Juan Aguilar <mhpoin@gmail.com>2019-01-12 22:36:01 +0100
commitd1a7ee02e5f8ebdc02cd973899202ec730a6f4bd (patch)
tree01b63451e187fbb3a1b8961344d87b58e03d9ee3
parent733422c59137ee166370576007bc4dae8f770f22 (diff)
downloadaskama-d1a7ee02e5f8ebdc02cd973899202ec730a6f4bd.tar.gz
askama-d1a7ee02e5f8ebdc02cd973899202ec730a6f4bd.tar.bz2
askama-d1a7ee02e5f8ebdc02cd973899202ec730a6f4bd.zip
Prevent trait object issues
Diffstat (limited to '')
-rw-r--r--askama/src/lib.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/askama/src/lib.rs b/askama/src/lib.rs
index 91ebdd3..d643c18 100644
--- a/askama/src/lib.rs
+++ b/askama/src/lib.rs
@@ -461,7 +461,7 @@ pub mod rocket {
pub use self::rocket::response::{Responder, Result};
- pub fn respond(t: &super::Template, ext: &str) -> Result<'static> {
+ pub fn respond<T: super::Template>(t: &T, ext: &str) -> Result<'static> {
let rsp = t.render().map_err(|_| Status::InternalServerError)?;
let ctype = ContentType::from_extension(ext).ok_or(Status::InternalServerError)?;
Response::build()
@@ -485,7 +485,7 @@ pub mod actix_web {
};
use self::mime_guess::get_mime_type;
- pub fn respond(t: &super::Template, ext: &str) -> Result<HttpResponse, Error> {
+ pub fn respond<T: super::Template>(t: &T, ext: &str) -> Result<HttpResponse, Error> {
let rsp = t
.render()
.map_err(|_| ErrorInternalServerError("Template parsing error"))?;
@@ -502,7 +502,7 @@ pub mod gotham {
pub use hyper::{Body, Response, StatusCode};
use mime_guess::get_mime_type;
- pub fn respond(t: &super::Template, ext: &str) -> Response<Body> {
+ pub fn respond<T: super::Template>(t: &T, ext: &str) -> Response<Body> {
let mime_type = get_mime_type(ext).to_string();
match t.render() {