Add Rocket support
This commit is contained in:
parent
efe3af85e2
commit
4cc8698638
2 changed files with 15 additions and 0 deletions
maud
|
@ -14,3 +14,4 @@ Compile-time HTML templates.
|
|||
|
||||
[dependencies]
|
||||
iron = { version = "0.4.0", optional = true }
|
||||
rocket = { version = "0.1.2", optional = true }
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
//! [book]: https://maud.lambda.xyz/
|
||||
|
||||
#[cfg(feature = "iron")] extern crate iron;
|
||||
#[cfg(feature = "rocket")] extern crate rocket;
|
||||
|
||||
use std::fmt::{self, Write};
|
||||
|
||||
|
@ -207,3 +208,16 @@ mod iron_support {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "rocket")]
|
||||
mod rocket_support {
|
||||
use rocket::http::Status;
|
||||
use rocket::response::{Responder, Response};
|
||||
use PreEscaped;
|
||||
|
||||
impl Responder<'static> for PreEscaped<String> {
|
||||
fn respond(self) -> Result<Response<'static>, Status> {
|
||||
self.into_string().respond()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue