From 2966407dc14e442de9fffa00d9ef3db52b7ba2ce Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Mon, 4 Jul 2022 11:10:52 +0200 Subject: [PATCH] Re-export `debug_handler` from axum (#1144) * Re-export `debug_handler` from axum Fixes #1143 * also axum-extra --- axum-macros/Cargo.toml | 2 +- axum/CHANGELOG.md | 3 +++ axum/Cargo.toml | 2 ++ axum/src/lib.rs | 4 ++++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/axum-macros/Cargo.toml b/axum-macros/Cargo.toml index af9e65ea..57850158 100644 --- a/axum-macros/Cargo.toml +++ b/axum-macros/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT" name = "axum-macros" readme = "README.md" repository = "https://github.com/tokio-rs/axum" -version = "0.2.3" +version = "0.2.3" # remember to also bump the version that axum and axum-extra depends on [lib] proc-macro = true diff --git a/axum/CHANGELOG.md b/axum/CHANGELOG.md index 1c9c7d8a..a510d282 100644 --- a/axum/CHANGELOG.md +++ b/axum/CHANGELOG.md @@ -18,6 +18,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 if you want the old behavior ([#1119]) - **added** Implement `TryFrom` for `MethodFilter` and use new `NoMatchingMethodFilter` error in case of failure ([#1130]) - **added:** Support running extractors from `middleware::from_fn` functions ([#1088]) +- **added:** Added `debug_handler` which is an attribute macro that improves + type errors when applied to handler function. It is re-exported from + `axum-macros` [#1077]: https://github.com/tokio-rs/axum/pull/1077 [#1088]: https://github.com/tokio-rs/axum/pull/1088 diff --git a/axum/Cargo.toml b/axum/Cargo.toml index 45bd4e73..7a42484b 100644 --- a/axum/Cargo.toml +++ b/axum/Cargo.toml @@ -16,6 +16,7 @@ form = ["serde_urlencoded"] http1 = ["hyper/http1"] http2 = ["hyper/http2"] json = ["serde_json"] +macros = ["axum-macros"] matched-path = [] multipart = ["multer"] original-uri = [] @@ -47,6 +48,7 @@ tower-layer = "0.3" tower-service = "0.3" # optional dependencies +axum-macros = { path = "../axum-macros", version = "0.2.3", optional = true } base64 = { version = "0.13", optional = true } headers = { version = "0.3.7", optional = true } multer = { version = "2.0.0", optional = true } diff --git a/axum/src/lib.rs b/axum/src/lib.rs index c5f19505..be095caa 100644 --- a/axum/src/lib.rs +++ b/axum/src/lib.rs @@ -310,6 +310,7 @@ //! `http1` | Enables hyper's `http1` feature | Yes //! `http2` | Enables hyper's `http2` feature | No //! `json` | Enables the [`Json`] type and some similar convenience functionality | Yes +//! `macros` | Enables optional utility macros | No //! `matched-path` | Enables capturing of every request's router path and the [`MatchedPath`] extractor | Yes //! `multipart` | Enables parsing `multipart/form-data` requests with [`Multipart`] | No //! `original-uri` | Enables capturing of every request's original URI and the [`OriginalUri`] extractor | Yes @@ -442,3 +443,6 @@ pub use self::form::Form; #[doc(inline)] pub use axum_core::{BoxError, Error}; + +#[cfg(feature = "macros")] +pub use axum_macros::debug_handler;