Skip to content

Commit dfa7d5a

Browse files
authored
Merge pull request #182 from czyba/master
actix-web >= 2.0.0 support
2 parents c119dbc + 34d1b6a commit dfa7d5a

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Change Log
22

33
## [Unreleased]
4+
- [Changed] Update Actix to 2.0.0. Actix 1.0.0 is no longer supported.
5+
[#182](https://github.com/lambda-fairy/maud/pull/182)
46

57
## [0.21.0] - 2019-07-01
68

maud/Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,16 @@ description = "Compile-time HTML templates."
1111
categories = ["template-engine"]
1212
edition = "2018"
1313

14+
[features]
15+
actix-web = ["actix-web-dep", "futures"]
16+
1417
[dependencies]
1518
maud_htmlescape = { version = "0.17.0", path = "../maud_htmlescape" }
1619
maud_macros = { version = "0.21.0", path = "../maud_macros" }
1720
iron = { version = ">= 0.5.1, < 0.7.0", optional = true }
1821
rocket = { version = ">= 0.3, < 0.5", optional = true }
19-
actix-web = { version = "1.0.0", optional = true, default-features = false }
22+
futures = { version = "0.3.0", optional = true }
23+
actix-web-dep = { version = "2.0.0", optional = true, default-features = false, package = "actix-web" }
2024

2125
[dev-dependencies]
2226
compiletest_rs = { version = "0.3.19", features = ["stable"] }

maud/src/lib.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
1010
#![doc(html_root_url = "https://docs.rs/maud/0.21.0")]
1111

12-
#[cfg(feature = "actix-web")] extern crate actix_web;
12+
#[cfg(feature = "actix-web")] extern crate actix_web_dep;
1313
#[cfg(feature = "iron")] extern crate iron;
1414
#[cfg(feature = "rocket")] extern crate rocket;
1515

@@ -194,13 +194,14 @@ mod rocket_support {
194194
#[cfg(feature = "actix-web")]
195195
mod actix_support {
196196
use crate::PreEscaped;
197-
use actix_web::{Responder, HttpResponse, HttpRequest, Error};
197+
use actix_web_dep::{Responder, HttpResponse, HttpRequest, Error};
198+
use futures::future::{ok, Ready};
198199

199200
impl Responder for PreEscaped<String> {
200201
type Error = Error;
201-
type Future = Result<HttpResponse, Self::Error>;
202+
type Future = Ready<Result<HttpResponse, Self::Error>>;
202203
fn respond_to(self, _req: &HttpRequest) -> Self::Future {
203-
Ok(HttpResponse::Ok()
204+
ok(HttpResponse::Ok()
204205
.content_type("text/html; charset=utf-8")
205206
.body(self.0))
206207
}

0 commit comments

Comments
 (0)