diff options
author | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2020-06-30 13:51:12 +0200 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2020-06-30 13:51:12 +0200 |
commit | 44ad3df6e110cc85e58762b980df2f59f110834b (patch) | |
tree | fea7d0a402f2e3f7e6d1d903899b243f74aab546 | |
parent | 05b66eb3d9b7790dfeccee4eafef952f7a7ea29f (diff) | |
download | askama-44ad3df6e110cc85e58762b980df2f59f110834b.tar.gz askama-44ad3df6e110cc85e58762b980df2f59f110834b.tar.bz2 askama-44ad3df6e110cc85e58762b980df2f59f110834b.zip |
Tweak dependency on futures for Actix integration
-rw-r--r-- | askama_actix/Cargo.toml | 2 | ||||
-rw-r--r-- | askama_actix/src/lib.rs | 7 | ||||
-rw-r--r-- | askama_shared/src/generator.rs | 4 |
3 files changed, 10 insertions, 3 deletions
diff --git a/askama_actix/Cargo.toml b/askama_actix/Cargo.toml index 7a6b91e..05439e1 100644 --- a/askama_actix/Cargo.toml +++ b/askama_actix/Cargo.toml @@ -17,7 +17,7 @@ edition = "2018" actix-web = { version = "2" } askama = { version = "0.10", path = "../askama", features = ["with-actix-web", "mime", "mime_guess"] } bytes = { version = "0.5" } -futures = { version = "0.3" } +futures-util = { version = "0.3" } [dev-dependencies] actix-rt = { version = "1", default-features = false } diff --git a/askama_actix/src/lib.rs b/askama_actix/src/lib.rs index 7372034..e0f78ca 100644 --- a/askama_actix/src/lib.rs +++ b/askama_actix/src/lib.rs @@ -20,3 +20,10 @@ impl<T: askama::Template> TemplateIntoResponse for T { .body(buffer.freeze())) } } + +// Re-exported for use by generated code +#[doc(hidden)] +pub mod futures { + pub use futures_util::future::ready; + pub use futures_util::future::Ready; +} diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs index 36ac55e..180a356 100644 --- a/askama_shared/src/generator.rs +++ b/askama_shared/src/generator.rs @@ -254,7 +254,7 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { // Implement Actix-web's `Responder`. fn impl_actix_web_responder(&mut self, buf: &mut Buffer) { self.write_header(buf, "::actix_web::Responder", None); - buf.writeln("type Future = ::futures::future::Ready<::std::result::Result<::actix_web::HttpResponse, Self::Error>>;"); + buf.writeln("type Future = ::askama_actix::futures::Ready<::std::result::Result<::actix_web::HttpResponse, Self::Error>>;"); buf.writeln("type Error = ::actix_web::Error;"); buf.writeln( "fn respond_to(self, _req: &::actix_web::HttpRequest) \ @@ -262,7 +262,7 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { ); buf.writeln("use ::askama_actix::TemplateIntoResponse;"); - buf.writeln("::futures::future::ready(self.into_response())"); + buf.writeln("::askama_actix::futures::ready(self.into_response())"); buf.writeln("}"); buf.writeln("}"); |