From 82a19afa00ca4bb376a42106a71ed8894ce96d69 Mon Sep 17 00:00:00 2001 From: Chris Wong Date: Sat, 4 Sep 2021 16:53:20 +1000 Subject: [PATCH] Remove Iron support The Iron framework hasn't been updated in a long time. It still uses outdated versions of libraries like futures 0.1, hyper 0.12, url 1.7. We can speed up CI by removing it. --- docs/content/web-frameworks.md | 39 +--------------------------------- doctest/Cargo.toml | 3 +-- maud/Cargo.toml | 1 - maud/src/lib.rs | 29 ------------------------- 4 files changed, 2 insertions(+), 70 deletions(-) diff --git a/docs/content/web-frameworks.md b/docs/content/web-frameworks.md index 93b6026c..fb05fd4f 100644 --- a/docs/content/web-frameworks.md +++ b/docs/content/web-frameworks.md @@ -1,10 +1,9 @@ # Web framework integration Maud includes support for these web frameworks: -[Actix], [Iron], [Rocket], [Rouille], and [Tide]. +[Actix], [Rocket], [Rouille], and [Tide]. [Actix]: https://actix.rs/ -[Iron]: http://ironframework.io [Rocket]: https://rocket.rs/ [Rouille]: https://github.com/tomaka/rouille [Tide]: https://docs.rs/tide/ @@ -48,42 +47,6 @@ async fn main() -> io::Result<()> { } ``` -# Iron - -Iron support is available with the "iron" feature: - -```toml -# ... -[dependencies] -maud = { version = "*", features = ["iron"] } -# ... -``` - -With this feature enabled, -you can then build a `Response` from a `Markup` object directly. -Here's an example application using Iron and Maud: - -```rust,no_run -use iron::prelude::*; -use iron::status; -use maud::html; - -fn main() { - Iron::new(|r: &mut Request| { - let markup = html! { - h1 { "Hello, world!" } - p { - "You are viewing the page at " (r.url) - } - }; - Ok(Response::with((status::Ok, markup))) - }).http("localhost:3000").unwrap(); -} -``` - -`Markup` will set the content type of the response automatically, -so you don't need to add it yourself. - # Rocket Rocket works in a similar way, diff --git a/doctest/Cargo.toml b/doctest/Cargo.toml index 8ea9374c..82a990eb 100644 --- a/doctest/Cargo.toml +++ b/doctest/Cargo.toml @@ -7,8 +7,7 @@ edition = "2018" [dependencies] actix-web = "3" ammonia = "3" -iron = "0.6" -maud = { path = "../maud", features = ["actix-web", "iron", "rocket", "tide", "axum"] } +maud = { path = "../maud", features = ["actix-web", "rocket", "tide", "axum"] } pulldown-cmark = "0.8" rocket = "0.4" rouille = "3" diff --git a/maud/Cargo.toml b/maud/Cargo.toml index 72298665..393733ab 100644 --- a/maud/Cargo.toml +++ b/maud/Cargo.toml @@ -19,7 +19,6 @@ actix-web = ["actix-web-dep", "futures-util"] [dependencies] maud_macros = { version = "0.22.3", path = "../maud_macros" } -iron = { version = ">= 0.5.1, < 0.7.0", optional = true } 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 } diff --git a/maud/src/lib.rs b/maud/src/lib.rs index b39cd223..a3a026b5 100644 --- a/maud/src/lib.rs +++ b/maud/src/lib.rs @@ -208,35 +208,6 @@ impl + Into> From> for String { /// ``` pub const DOCTYPE: PreEscaped<&'static str> = PreEscaped(""); -#[cfg(feature = "iron")] -mod iron_support { - extern crate std; - - use crate::PreEscaped; - use alloc::{boxed::Box, string::String}; - use iron::{ - headers::ContentType, - modifier::{Modifier, Set}, - modifiers::Header, - response::{Response, WriteBody}, - }; - use std::io; - - impl Modifier for PreEscaped { - fn modify(self, response: &mut Response) { - response - .set_mut(Header(ContentType::html())) - .set_mut(Box::new(self) as Box); - } - } - - impl WriteBody for PreEscaped { - fn write_body(&mut self, body: &mut dyn io::Write) -> io::Result<()> { - self.0.write_body(body) - } - } -} - #[cfg(feature = "rocket")] mod rocket_support { extern crate std;