1
1
use http:: header:: ToStrError ;
2
- use hyper:: { self , body, Body , StatusCode } ;
2
+ use http:: StatusCode ;
3
+ #[ cfg( feature = "enable_hyper" ) ]
4
+ use hyper:: { self , body, Body } ;
3
5
use std:: io:: Error as IOError ;
4
6
use std:: num;
5
7
use std:: num:: ParseIntError ;
@@ -191,10 +193,10 @@ quick_error! {
191
193
display( "json error: {}" , err)
192
194
cause( err)
193
195
}
194
- HyperError ( err: hyper :: Error ) {
196
+ HyperError ( err: Box <dyn std :: error :: Error + Sync + Send > ) {
195
197
from( )
196
198
display( "Hyper error: {}" , err)
197
- cause( err)
199
+ cause( & * * err)
198
200
}
199
201
PermissionError ( err: PermissionError ) {
200
202
from( )
@@ -281,7 +283,7 @@ quick_error! {
281
283
display( "uuid error: {}" , err)
282
284
cause( err)
283
285
}
284
- ChronoParserError ( err: chrono:: ParseError ) {
286
+ ChronoParserError ( err: chrono:: ParseError ) {
285
287
from( )
286
288
display( "Chrono parser error: {}" , err)
287
289
cause( err)
@@ -373,6 +375,14 @@ impl From<failure::Error> for AzureError {
373
375
}
374
376
}
375
377
378
+ #[ cfg( feature = "enable_hyper" ) ]
379
+ impl From < hyper:: Error > for AzureError {
380
+ fn from ( error : hyper:: Error ) -> AzureError {
381
+ AzureError :: HyperError ( error. into ( ) )
382
+ }
383
+ }
384
+
385
+ #[ cfg( feature = "enable_hyper" ) ]
376
386
#[ inline]
377
387
pub async fn extract_status_headers_and_body (
378
388
resp : hyper:: client:: ResponseFuture ,
@@ -386,6 +396,7 @@ pub async fn extract_status_headers_and_body(
386
396
Ok ( ( status, headers, body) )
387
397
}
388
398
399
+ #[ cfg( feature = "enable_hyper" ) ]
389
400
#[ inline]
390
401
pub async fn extract_status_and_body (
391
402
resp : hyper:: client:: ResponseFuture ,
@@ -396,6 +407,7 @@ pub async fn extract_status_and_body(
396
407
Ok ( ( status, str:: from_utf8 ( & body) ?. to_owned ( ) ) )
397
408
}
398
409
410
+ #[ cfg( feature = "enable_hyper" ) ]
399
411
#[ inline]
400
412
pub async fn extract_location_status_and_body (
401
413
resp : hyper:: client:: ResponseFuture ,
@@ -410,6 +422,7 @@ pub async fn extract_location_status_and_body(
410
422
Ok ( ( status, location, str:: from_utf8 ( & body) ?. to_owned ( ) ) )
411
423
}
412
424
425
+ #[ cfg( feature = "enable_hyper" ) ]
413
426
#[ inline]
414
427
pub async fn check_status_extract_body (
415
428
resp : hyper:: client:: ResponseFuture ,
@@ -427,6 +440,7 @@ pub async fn check_status_extract_body(
427
440
}
428
441
}
429
442
443
+ #[ cfg( feature = "enable_hyper" ) ]
430
444
pub async fn check_status_extract_body_2 (
431
445
resp : hyper:: Response < Body > ,
432
446
expected_status : StatusCode ,
0 commit comments