@@ -9,19 +9,19 @@ use std::old_io::net::ip::IpAddr;
9
9
pub use self :: typemap:: TypeMap ;
10
10
mod typemap;
11
11
12
- #[ derive( PartialEq , Show , Clone , Copy ) ]
12
+ #[ derive( PartialEq , Debug , Clone , Copy ) ]
13
13
pub enum Scheme {
14
14
Http ,
15
15
Https
16
16
}
17
17
18
- #[ derive( PartialEq , Show , Clone , Copy ) ]
18
+ #[ derive( PartialEq , Debug , Clone , Copy ) ]
19
19
pub enum Host < ' a > {
20
20
Name ( & ' a str ) ,
21
21
Ip ( IpAddr )
22
22
}
23
23
24
- #[ derive( PartialEq , Hash , Eq , Show , Clone , Copy ) ]
24
+ #[ derive( PartialEq , Hash , Eq , Debug , Clone , Copy ) ]
25
25
pub enum Method {
26
26
Get ,
27
27
Post ,
@@ -115,14 +115,15 @@ pub struct Response {
115
115
116
116
/// A Handler takes a request and returns a response or an error.
117
117
/// By default, a bare function implements `Handler`.
118
- pub trait Handler : Sync + Send {
118
+ pub trait Handler : Sync + Send {
119
119
fn call ( & self , request : & mut Request ) -> Result < Response , Box < Error +Send > > ;
120
120
}
121
121
122
- impl < F > Handler for F
123
- where F : Fn ( & mut Request ) -> Result < Response , Box < Error +Send > > + Sync + Send ,
122
+ impl < F , E > Handler for F
123
+ where F : Fn ( & mut Request ) -> Result < Response , E > + Sync + Send ,
124
+ E : Error + Send
124
125
{
125
126
fn call ( & self , request : & mut Request ) -> Result < Response , Box < Error +Send > > {
126
- ( * self ) ( request)
127
+ ( * self ) ( request) . map_err ( |e| Box :: new ( e ) as Box < Error + Send > )
127
128
}
128
129
}
0 commit comments