File tree Expand file tree Collapse file tree 5 files changed +17
-5
lines changed Expand file tree Collapse file tree 5 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
8
8
# Unreleased
9
9
10
+ - ** change:** Make the ` status ` function for rejections generated by the
11
+ ` __define_rejection ` and ` __composite_rejection ` macros a ` const ` function
12
+ ([ #3168 ] )
13
+
14
+ [ #3168 ] : https://github.com/tokio-rs/axum/pull/3168
15
+
10
16
# 0.5.0
11
17
12
18
## since rc.1
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ macro_rules! __define_rejection {
54
54
}
55
55
56
56
/// Get the status code used for this rejection.
57
- pub fn status( & self ) -> http:: StatusCode {
57
+ pub const fn status( & self ) -> http:: StatusCode {
58
58
http:: StatusCode :: $status
59
59
}
60
60
}
@@ -111,7 +111,7 @@ macro_rules! __define_rejection {
111
111
}
112
112
113
113
/// Get the status code used for this rejection.
114
- pub fn status( & self ) -> http:: StatusCode {
114
+ pub const fn status( & self ) -> http:: StatusCode {
115
115
http:: StatusCode :: $status
116
116
}
117
117
}
@@ -188,7 +188,7 @@ macro_rules! __composite_rejection {
188
188
}
189
189
190
190
/// Get the status code used for this rejection.
191
- pub fn status( & self ) -> http:: StatusCode {
191
+ pub const fn status( & self ) -> http:: StatusCode {
192
192
match self {
193
193
$(
194
194
Self :: $variant( inner) => inner. status( ) ,
Original file line number Diff line number Diff line change @@ -10,8 +10,11 @@ and this project adheres to [Semantic Versioning].
10
10
- ** breaking:** Remove unused ` async-stream ` feature, which was accidentally
11
11
introduced as an implicit feature through an optional dependency which was no
12
12
longer being used ([ #3145 ] )
13
+ - ** change:** Make the ` status ` function of rejections a ` const ` function, such
14
+ as ` FormRejection ` , ` QueryRejection ` and ` MultipartRejection ` ([ #3168 ] )
13
15
14
16
[ #3145 ] : https://github.com/tokio-rs/axum/pull/3145
17
+ [ #3168 ] : https://github.com/tokio-rs/axum/pull/3168
15
18
16
19
# 0.10.0
17
20
Original file line number Diff line number Diff line change @@ -9,9 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
10
10
- ** added:** Implement ` OptionalFromRequest ` for ` Json ` ([ #3142 ] )
11
11
- ** added:** Implement ` OptionalFromRequest ` for ` Extension ` ([ #3157 ] )
12
+ - ** change:** Make the ` status ` function of rejections a ` const ` function, such
13
+ as ` JsonRejection ` , ` QueryRejection ` and ` PathRejection ` ([ #3168 ] )
12
14
13
15
[ #3142 ] : https://github.com/tokio-rs/axum/pull/3142
14
16
[ #3157 ] : https://github.com/tokio-rs/axum/pull/3157
17
+ [ #3168 ] : https://github.com/tokio-rs/axum/pull/3168
15
18
16
19
# 0.8.0
17
20
Original file line number Diff line number Diff line change @@ -429,7 +429,7 @@ impl FailedToDeserializePathParams {
429
429
}
430
430
431
431
/// Get the status code used for this rejection.
432
- pub fn status ( & self ) -> StatusCode {
432
+ pub const fn status ( & self ) -> StatusCode {
433
433
match self . 0 . kind {
434
434
ErrorKind :: Message ( _)
435
435
| ErrorKind :: DeserializeError { .. }
@@ -563,7 +563,7 @@ impl InvalidUtf8InPathParam {
563
563
}
564
564
565
565
/// Get the status code used for this rejection.
566
- pub fn status ( & self ) -> StatusCode {
566
+ pub const fn status ( & self ) -> StatusCode {
567
567
StatusCode :: BAD_REQUEST
568
568
}
569
569
}
You can’t perform that action at this time.
0 commit comments