1+ use core:: ffi:: c_void;
2+ use core:: fmt;
13use core:: slice;
2- use std:: error:: Error ;
3- use std:: ffi:: c_void;
4- use std:: fmt;
5- use std:: str:: FromStr ;
4+ use core:: str:: FromStr ;
65
76use crate :: core:: * ;
87use crate :: ffi:: * ;
@@ -31,7 +30,7 @@ macro_rules! http_subrequest_handler {
3130 ( $name: ident, $handler: expr ) => {
3231 unsafe extern "C" fn $name(
3332 r: * mut $crate:: ffi:: ngx_http_request_t,
34- data: * mut :: std :: ffi:: c_void,
33+ data: * mut :: core :: ffi:: c_void,
3534 rc: $crate:: ffi:: ngx_int_t,
3635 ) -> $crate:: ffi:: ngx_int_t {
3736 $handler( r, data, rc)
@@ -117,7 +116,7 @@ impl Request {
117116 /// Is this the main request (as opposed to a subrequest)?
118117 pub fn is_main ( & self ) -> bool {
119118 let main = self . 0 . main . cast ( ) ;
120- std :: ptr:: eq ( self , main)
119+ core :: ptr:: eq ( self , main)
121120 }
122121
123122 /// Request pool.
@@ -338,7 +337,7 @@ impl Request {
338337 ngx_http_internal_redirect (
339338 ( self as * const Request as * mut Request ) . cast ( ) ,
340339 uri_ptr,
341- std :: ptr:: null_mut ( ) ,
340+ core :: ptr:: null_mut ( ) ,
342341 ) ;
343342 }
344343 }
@@ -355,7 +354,7 @@ impl Request {
355354 let uri_ptr = unsafe { & mut ngx_str_t:: from_str ( self . 0 . pool , uri) as * mut _ } ;
356355 // -------------
357356 // allocate memory and set values for ngx_http_post_subrequest_t
358- let sub_ptr = self . pool ( ) . alloc ( std :: mem:: size_of :: < ngx_http_post_subrequest_t > ( ) ) ;
357+ let sub_ptr = self . pool ( ) . alloc ( core :: mem:: size_of :: < ngx_http_post_subrequest_t > ( ) ) ;
359358
360359 // assert!(sub_ptr.is_null());
361360 let post_subreq = sub_ptr as * const ngx_http_post_subrequest_t as * mut ngx_http_post_subrequest_t ;
@@ -365,12 +364,12 @@ impl Request {
365364 }
366365 // -------------
367366
368- let mut psr: * mut ngx_http_request_t = std :: ptr:: null_mut ( ) ;
367+ let mut psr: * mut ngx_http_request_t = core :: ptr:: null_mut ( ) ;
369368 let r = unsafe {
370369 ngx_http_subrequest (
371370 ( self as * const Request as * mut Request ) . cast ( ) ,
372371 uri_ptr,
373- std :: ptr:: null_mut ( ) ,
372+ core :: ptr:: null_mut ( ) ,
374373 & mut psr as * mut _ ,
375374 sub_ptr as * mut _ ,
376375 NGX_HTTP_SUBREQUEST_WAITED as _ ,
@@ -384,7 +383,7 @@ impl Request {
384383 * allocate fake request body to avoid attempts to read it and to make
385384 * sure real body file (if already read) won't be closed by upstream
386385 */
387- sr. request_body = self . pool ( ) . alloc ( std :: mem:: size_of :: < ngx_http_request_body_t > ( ) ) as * mut _ ;
386+ sr. request_body = self . pool ( ) . alloc ( core :: mem:: size_of :: < ngx_http_request_body_t > ( ) ) as * mut _ ;
388387
389388 if sr. request_body . is_null ( ) {
390389 return Status :: NGX_ERROR ;
@@ -710,7 +709,8 @@ impl fmt::Display for InvalidMethod {
710709 }
711710}
712711
713- impl Error for InvalidMethod { }
712+ #[ cfg( feature = "std" ) ]
713+ impl std:: error:: Error for InvalidMethod { }
714714
715715#[ derive( Clone , PartialEq , Eq , Hash ) ]
716716enum MethodInner {
0 commit comments