impl Responder for actix-web framework
It looks similar to the Rocket implementation, and functionally is also similar: a syncronous response for PreEscaped<String> Refs #135
This commit is contained in:
parent
75763dd8a6
commit
fd59814f8b
2 changed files with 16 additions and 0 deletions
maud
|
@ -17,6 +17,7 @@ maud_htmlescape = { version = "0.17.0", path = "../maud_htmlescape" }
|
||||||
maud_macros = { version = "0.17.5", path = "../maud_macros" }
|
maud_macros = { version = "0.17.5", path = "../maud_macros" }
|
||||||
iron = { version = ">= 0.5.1, < 0.7.0", optional = true }
|
iron = { version = ">= 0.5.1, < 0.7.0", optional = true }
|
||||||
rocket = { version = "0.3", optional = true }
|
rocket = { version = "0.3", optional = true }
|
||||||
|
actix-web = { version = "0.6.12", optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
maud_lints = { version = "0.17.0", path = "../maud_lints" }
|
maud_lints = { version = "0.17.0", path = "../maud_lints" }
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
#![doc(html_root_url = "https://docs.rs/maud/0.17.5")]
|
#![doc(html_root_url = "https://docs.rs/maud/0.17.5")]
|
||||||
|
|
||||||
|
#[cfg(feature = "actix-web")] extern crate actix_web;
|
||||||
#[cfg(feature = "iron")] extern crate iron;
|
#[cfg(feature = "iron")] extern crate iron;
|
||||||
#[cfg(feature = "rocket")] extern crate rocket;
|
#[cfg(feature = "rocket")] extern crate rocket;
|
||||||
|
|
||||||
|
@ -189,3 +190,17 @@ mod rocket_support {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "actix-web")]
|
||||||
|
mod actix_support {
|
||||||
|
use PreEscaped;
|
||||||
|
use actix_web::{Responder, HttpResponse, HttpRequest, Error};
|
||||||
|
|
||||||
|
impl Responder for PreEscaped<String> {
|
||||||
|
type Item = HttpResponse;
|
||||||
|
type Error = Error;
|
||||||
|
fn respond_to<String>(self, _req: &HttpRequest<String>) -> Result<Self::Item, Self::Error> {
|
||||||
|
Ok(HttpResponse::Ok().body(self.0))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue