From baad3b6dd18ffc5b4669f9e27383440cb6530779 Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Tue, 12 Oct 2021 16:32:01 +0200 Subject: [PATCH 1/2] Update to support axum 0.2 --- docs/content/web-frameworks.md | 10 +++++----- doctest/Cargo.toml | 2 +- maud/Cargo.toml | 2 +- maud/src/lib.rs | 3 +++ 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/docs/content/web-frameworks.md b/docs/content/web-frameworks.md index a48d8ca8..93b6026c 100644 --- a/docs/content/web-frameworks.md +++ b/docs/content/web-frameworks.md @@ -194,18 +194,18 @@ This then allows you to use it directly as a response! ```rust,no_run use maud::{html, Markup}; -use axum::prelude::*; +use axum::{Router, handler::get}; async fn hello_world() -> Markup { - html! { - h1 { "Hello, World!" } + html! { + h1 { "Hello, World!" } } } #[tokio::main] async fn main() { // build our application with a single route - let app = route("/", get(hello_world)); + let app = Router::new().route("/", get(hello_world)); // run it with hyper on localhost:3000 axum::Server::bind(&"0.0.0.0:3000".parse().unwrap()) @@ -213,4 +213,4 @@ async fn main() { .await .unwrap(); } -``` \ No newline at end of file +``` diff --git a/doctest/Cargo.toml b/doctest/Cargo.toml index a06e4cf3..8ea9374c 100644 --- a/doctest/Cargo.toml +++ b/doctest/Cargo.toml @@ -14,7 +14,7 @@ rocket = "0.4" rouille = "3" tide = "0.16" tokio = { version = "1.9.0", features = ["rt", "macros", "rt-multi-thread"] } -axum = "0.1.3" +axum = "0.2" [dependencies.async-std] version = "1.9.0" diff --git a/maud/Cargo.toml b/maud/Cargo.toml index dd92af39..955ddb3c 100644 --- a/maud/Cargo.toml +++ b/maud/Cargo.toml @@ -25,7 +25,7 @@ rocket = { version = ">= 0.3, < 0.5", optional = true } futures-util = { version = "0.3.0", optional = true, default-features = false } actix-web-dep = { package = "actix-web", version = ">= 2, < 4", optional = true, default-features = false } tide = { version = "0.16.0", optional = true, default-features = false } -axum = { version = "0.1.3", optional = true } +axum = { version = "0.2", optional = true } [dev-dependencies] trybuild = { version = "1.0.33", features = ["diff"] } diff --git a/maud/src/lib.rs b/maud/src/lib.rs index 670a81f9..cca9ff7d 100644 --- a/maud/src/lib.rs +++ b/maud/src/lib.rs @@ -268,6 +268,9 @@ mod axum_support { }; impl IntoResponse for PreEscaped { + type Body = Body; + type BodyError = ::Error; + fn into_response(self) -> Response { let mut res = Response::new(Body::from(self.0)); *res.status_mut() = StatusCode::OK; From 579f06c9425db3b1d207b69cb020240011dc81c2 Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Tue, 12 Oct 2021 16:34:09 +0200 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee090b8b..073ba41c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## [Unreleased] +- Update to support axum 0.2 + [#303](https://github.com/lambda-fairy/maud/pull/303) + ## [0.22.3] - 2021-09-27 - Support `no_std` + `alloc`.