File tree 3 files changed +11
-6
lines changed 3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change 5
5
- Add ` ServiceRequest::extract() ` to make it easier to use extractors when writing middlewares. [ #2647 ]
6
6
- Add ` Route::wrap() ` to allow individual routes to use middleware. [ #2725 ]
7
7
- Add ` ServiceConfig::default_service() ` . [ #2338 ] [ #2743 ]
8
+ - Implement ` ResponseError ` for ` std::convert::Infallible `
8
9
9
10
### Fixed
10
11
- Clear connection-level data on ` HttpRequest ` drop. [ #2742 ]
Original file line number Diff line number Diff line change @@ -51,12 +51,6 @@ impl StdError for Error {
51
51
}
52
52
}
53
53
54
- impl From < std:: convert:: Infallible > for Error {
55
- fn from ( val : std:: convert:: Infallible ) -> Self {
56
- match val { }
57
- }
58
- }
59
-
60
54
/// `Error` for any error that implements `ResponseError`
61
55
impl < T : ResponseError + ' static > From < T > for Error {
62
56
fn from ( err : T ) -> Error {
Original file line number Diff line number Diff line change 1
1
//! `ResponseError` trait and foreign impls.
2
2
3
3
use std:: {
4
+ convert:: Infallible ,
4
5
error:: Error as StdError ,
5
6
fmt,
6
7
io:: { self , Write as _} ,
@@ -54,6 +55,15 @@ downcast_dyn!(ResponseError);
54
55
55
56
impl ResponseError for Box < dyn StdError + ' static > { }
56
57
58
+ impl ResponseError for Infallible {
59
+ fn status_code ( & self ) -> StatusCode {
60
+ match * self { }
61
+ }
62
+ fn error_response ( & self ) -> HttpResponse < BoxBody > {
63
+ match * self { }
64
+ }
65
+ }
66
+
57
67
#[ cfg( feature = "openssl" ) ]
58
68
impl ResponseError for actix_tls:: accept:: openssl:: reexports:: Error { }
59
69
You can’t perform that action at this time.
0 commit comments