Revert "Make status a const function in rejection handling" (#3287)

This commit is contained in:
Jonas Platte
2025-03-27 08:31:19 +01:00
committed by GitHub
parent 2b6ae09568
commit 3525a13459
5 changed files with 20 additions and 20 deletions
+2 -4
View File
@@ -7,11 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
# 0.5.1
- **change:** Make the `status` function for rejections generated by the
`__define_rejection` and `__composite_rejection` macros a `const` function
([#3168])
Yanked from crates.io due to unforeseen breaking change, see [#3190] for details.
[#3168]: https://github.com/tokio-rs/axum/pull/3168
[#3190]: https://github.com/tokio-rs/axum/pull/3190
# 0.5.0
+3 -3
View File
@@ -54,7 +54,7 @@ macro_rules! __define_rejection {
}
/// Get the status code used for this rejection.
pub const fn status(&self) -> http::StatusCode {
pub fn status(&self) -> http::StatusCode {
http::StatusCode::$status
}
}
@@ -111,7 +111,7 @@ macro_rules! __define_rejection {
}
/// Get the status code used for this rejection.
pub const fn status(&self) -> http::StatusCode {
pub fn status(&self) -> http::StatusCode {
http::StatusCode::$status
}
}
@@ -188,7 +188,7 @@ macro_rules! __composite_rejection {
}
/// Get the status code used for this rejection.
pub const fn status(&self) -> http::StatusCode {
pub fn status(&self) -> http::StatusCode {
match self {
$(
Self::$variant(inner) => inner.status(),
+7 -4
View File
@@ -5,19 +5,22 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog],
and this project adheres to [Semantic Versioning].
# 0.11.0
# Unreleased
- **breaking:** Remove unused `async-stream` feature, which was accidentally
introduced as an implicit feature through an optional dependency which was no
longer being used ([#3145])
- **fixed:** Fix a broken link in the documentation of `ErasedJson` ([#3186])
- **changed:** Make the `status` function of rejections a `const` function, such
as `FormRejection`, `QueryRejection` and `MultipartRejection` ([#3168])
[#3145]: https://github.com/tokio-rs/axum/pull/3145
[#3168]: https://github.com/tokio-rs/axum/pull/3168
[#3186]: https://github.com/tokio-rs/axum/pull/3186
# 0.11.0
Yanked from crates.io due to unforeseen breaking change, see [#3190] for details.
[#3190]: https://github.com/tokio-rs/axum/pull/3190
# 0.10.0
## since rc.1
+6 -7
View File
@@ -8,21 +8,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
# Unreleased
- **added:** Implement `From<Bytes>` for `Message` ([#3273])
- **added:** Implement `OptionalFromRequest` for `Json` ([#3142])
- **added:** Implement `OptionalFromRequest` for `Extension` ([#3157])
- **changed:** Improved code size / compile time of `Handler` implementations ([#3285])
[#3273]: https://github.com/tokio-rs/axum/pull/3273
[#3142]: https://github.com/tokio-rs/axum/pull/3142
[#3157]: https://github.com/tokio-rs/axum/pull/3157
[#3285]: https://github.com/tokio-rs/axum/pull/3285
# 0.8.2
- **added:** Implement `OptionalFromRequest` for `Json` ([#3142])
- **added:** Implement `OptionalFromRequest` for `Extension` ([#3157])
- **changed:** Make the `status` function of rejections a `const` function, such
as `JsonRejection`, `QueryRejection` and `PathRejection` ([#3168])
Yanked from crates.io due to unforeseen breaking change, see [#3190] for details.
[#3142]: https://github.com/tokio-rs/axum/pull/3142
[#3157]: https://github.com/tokio-rs/axum/pull/3157
[#3168]: https://github.com/tokio-rs/axum/pull/3168
[#3190]: https://github.com/tokio-rs/axum/pull/3190
# 0.8.1
+2 -2
View File
@@ -429,7 +429,7 @@ impl FailedToDeserializePathParams {
}
/// Get the status code used for this rejection.
pub const fn status(&self) -> StatusCode {
pub fn status(&self) -> StatusCode {
match self.0.kind {
ErrorKind::Message(_)
| ErrorKind::DeserializeError { .. }
@@ -563,7 +563,7 @@ impl InvalidUtf8InPathParam {
}
/// Get the status code used for this rejection.
pub const fn status(&self) -> StatusCode {
pub fn status(&self) -> StatusCode {
StatusCode::BAD_REQUEST
}
}