From 073da0533b39933ff02c326cd65d78b3d50cc4e0 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 a48d8ca8..23d01bb3 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 a06e4cf3..441c1d54 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 76c4882c..536e7a12 100644 --- a/maud/Cargo.toml +++ b/maud/Cargo.toml @@ -20,7 +20,6 @@ actix-web = ["actix-web-dep", "futures-util"] [dependencies] maud_htmlescape = { version = "0.17.0", path = "../maud_htmlescape" } maud_macros = { version = "0.22.2", 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 adf707d9..be8e3da7 100644 --- a/maud/src/lib.rs +++ b/maud/src/lib.rs @@ -171,35 +171,6 @@ pub use maud_htmlescape::Escaper; /// ``` 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;