feat: add actix impl Responder for Element
This commit is contained in:
parent
c29e2a70f0
commit
6ce848ac5f
3 changed files with 1219 additions and 0 deletions
1204
Cargo.lock
generated
1204
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -8,6 +8,8 @@ edition = "2021"
|
|||
[features]
|
||||
default = ["dom", "fs"]
|
||||
dom = []
|
||||
actix = ["actix-web"]
|
||||
fs = []
|
||||
|
||||
[dependencies]
|
||||
actix-web = { version = "4.4.0", optional = true }
|
|
@ -94,6 +94,19 @@ impl Element {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "actix")]
|
||||
use actix_web::{HttpRequest, HttpResponse, HttpResponseBuilder, Responder};
|
||||
#[cfg(feature = "actix")]
|
||||
impl Responder for Element {
|
||||
type Body = String;
|
||||
|
||||
fn respond_to(self, req: &HttpRequest) -> HttpResponse<Self::Body> {
|
||||
HttpResponse::Ok()
|
||||
.body(self.into())
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl ToString for Element {
|
||||
fn to_string(&self) -> String {
|
||||
let mut s = String::new();
|
||||
|
|
Loading…
Reference in a new issue