@@ -36,10 +36,15 @@ pub(crate) enum Kind {
3636 /// Error occurred while connecting.
3737 Connect ,
3838 /// Error creating a TcpListener.
39- #[ cfg( all( any( feature = "http1" , feature = "http2" ) , feature = "tcp" ) ) ]
39+ #[ cfg( all(
40+ any( feature = "http1" , feature = "http2" ) ,
41+ feature = "tcp" ,
42+ feature = "server"
43+ ) ) ]
4044 Listen ,
4145 /// Error accepting on an Incoming stream.
4246 #[ cfg( any( feature = "http1" , feature = "http2" ) ) ]
47+ #[ cfg( feature = "server" ) ]
4348 Accept ,
4449 /// Error while reading a body from connection.
4550 #[ cfg( any( feature = "http1" , feature = "http2" , feature = "stream" ) ) ]
@@ -77,6 +82,7 @@ pub(crate) enum User {
7782 Body ,
7883 /// Error calling user's MakeService.
7984 #[ cfg( any( feature = "http1" , feature = "http2" ) ) ]
85+ #[ cfg( feature = "server" ) ]
8086 MakeService ,
8187 /// Error from future of user's Service.
8288 #[ cfg( any( feature = "http1" , feature = "http2" ) ) ]
@@ -85,6 +91,7 @@ pub(crate) enum User {
8591 ///
8692 /// For example, sending both `content-length` and `transfer-encoding`.
8793 #[ cfg( feature = "http1" ) ]
94+ #[ cfg( feature = "server" ) ]
8895 UnexpectedHeader ,
8996 /// User tried to create a Request with bad version.
9097 #[ cfg( any( feature = "http1" , feature = "http2" ) ) ]
@@ -96,6 +103,7 @@ pub(crate) enum User {
96103 UnsupportedRequestMethod ,
97104 /// User tried to respond with a 1xx (not 101) response code.
98105 #[ cfg( feature = "http1" ) ]
106+ #[ cfg( feature = "server" ) ]
99107 UnsupportedStatusCode ,
100108 /// User tried to send a Request with Client with non-absolute URI.
101109 #[ cfg( any( feature = "http1" , feature = "http2" ) ) ]
@@ -178,6 +186,7 @@ impl Error {
178186 }
179187
180188 #[ cfg( feature = "http1" ) ]
189+ #[ cfg( feature = "server" ) ]
181190 pub ( crate ) fn kind ( & self ) -> & Kind {
182191 & self . inner . kind
183192 }
@@ -234,11 +243,13 @@ impl Error {
234243 }
235244
236245 #[ cfg( all( any( feature = "http1" , feature = "http2" ) , feature = "tcp" ) ) ]
246+ #[ cfg( feature = "server" ) ]
237247 pub ( crate ) fn new_listen < E : Into < Cause > > ( cause : E ) -> Error {
238248 Error :: new ( Kind :: Listen ) . with ( cause)
239249 }
240250
241251 #[ cfg( any( feature = "http1" , feature = "http2" ) ) ]
252+ #[ cfg( feature = "server" ) ]
242253 pub ( crate ) fn new_accept < E : Into < Cause > > ( cause : E ) -> Error {
243254 Error :: new ( Kind :: Accept ) . with ( cause)
244255 }
@@ -272,6 +283,7 @@ impl Error {
272283 }
273284
274285 #[ cfg( feature = "http1" ) ]
286+ #[ cfg( feature = "server" ) ]
275287 pub ( crate ) fn new_user_header ( ) -> Error {
276288 Error :: new_user ( User :: UnexpectedHeader )
277289 }
@@ -289,6 +301,7 @@ impl Error {
289301 }
290302
291303 #[ cfg( feature = "http1" ) ]
304+ #[ cfg( feature = "server" ) ]
292305 pub ( crate ) fn new_user_unsupported_status_code ( ) -> Error {
293306 Error :: new_user ( User :: UnsupportedStatusCode )
294307 }
@@ -309,6 +322,7 @@ impl Error {
309322 }
310323
311324 #[ cfg( any( feature = "http1" , feature = "http2" ) ) ]
325+ #[ cfg( feature = "server" ) ]
312326 pub ( crate ) fn new_user_make_service < E : Into < Cause > > ( cause : E ) -> Error {
313327 Error :: new_user ( User :: MakeService ) . with ( cause)
314328 }
@@ -354,8 +368,10 @@ impl Error {
354368 Kind :: Connect => "error trying to connect" ,
355369 Kind :: Canceled => "operation was canceled" ,
356370 #[ cfg( all( any( feature = "http1" , feature = "http2" ) , feature = "tcp" ) ) ]
371+ #[ cfg( feature = "server" ) ]
357372 Kind :: Listen => "error creating server listener" ,
358373 #[ cfg( any( feature = "http1" , feature = "http2" ) ) ]
374+ #[ cfg( feature = "server" ) ]
359375 Kind :: Accept => "error accepting connection" ,
360376 #[ cfg( any( feature = "http1" , feature = "http2" , feature = "stream" ) ) ]
361377 Kind :: Body => "error reading a body from connection" ,
@@ -372,10 +388,12 @@ impl Error {
372388 #[ cfg( any( feature = "http1" , feature = "http2" ) ) ]
373389 Kind :: User ( User :: Body ) => "error from user's HttpBody stream" ,
374390 #[ cfg( any( feature = "http1" , feature = "http2" ) ) ]
391+ #[ cfg( feature = "server" ) ]
375392 Kind :: User ( User :: MakeService ) => "error from user's MakeService" ,
376393 #[ cfg( any( feature = "http1" , feature = "http2" ) ) ]
377394 Kind :: User ( User :: Service ) => "error from user's Service" ,
378395 #[ cfg( feature = "http1" ) ]
396+ #[ cfg( feature = "server" ) ]
379397 Kind :: User ( User :: UnexpectedHeader ) => "user sent unexpected header" ,
380398 #[ cfg( any( feature = "http1" , feature = "http2" ) ) ]
381399 #[ cfg( feature = "client" ) ]
@@ -384,6 +402,7 @@ impl Error {
384402 #[ cfg( feature = "client" ) ]
385403 Kind :: User ( User :: UnsupportedRequestMethod ) => "request has unsupported HTTP method" ,
386404 #[ cfg( feature = "http1" ) ]
405+ #[ cfg( feature = "server" ) ]
387406 Kind :: User ( User :: UnsupportedStatusCode ) => {
388407 "response has 1xx status code, not supported by server"
389408 }
0 commit comments