@@ -91,7 +91,7 @@ pub mod ffi {
91
91
base : * const c_char ,
92
92
base_length : usize ,
93
93
) -> bool ;
94
- pub fn ada_get_components ( url : * mut ada_url ) -> ada_url_components ;
94
+ pub fn ada_get_components ( url : * mut ada_url ) -> * mut ada_url_components ;
95
95
96
96
// Getters
97
97
pub fn ada_get_origin ( url : * mut ada_url ) -> ada_owned_string ;
@@ -502,18 +502,20 @@ impl std::convert::AsRef<[u8]> for Url {
502
502
503
503
impl std:: fmt:: Debug for Url {
504
504
fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
505
- let components = unsafe { ffi:: ada_get_components ( self . url ) } ;
506
- f. debug_struct ( "Url" )
507
- . field ( "href" , & self . href ( ) )
508
- . field ( "protocol_end" , & components. protocol_end )
509
- . field ( "username_end" , & components. username_end )
510
- . field ( "host_start" , & components. host_start )
511
- . field ( "host_end" , & components. host_end )
512
- . field ( "port" , & components. port )
513
- . field ( "pathname_start" , & components. pathname_start )
514
- . field ( "search_start" , & components. search_start )
515
- . field ( "hash_start" , & components. hash_start )
516
- . finish ( )
505
+ unsafe {
506
+ let components = ffi:: ada_get_components ( self . url ) . as_ref ( ) . unwrap ( ) ;
507
+ f. debug_struct ( "Url" )
508
+ . field ( "href" , & self . href ( ) )
509
+ . field ( "protocol_end" , & components. protocol_end )
510
+ . field ( "username_end" , & components. username_end )
511
+ . field ( "host_start" , & components. host_start )
512
+ . field ( "host_end" , & components. host_end )
513
+ . field ( "port" , & components. port )
514
+ . field ( "pathname_start" , & components. pathname_start )
515
+ . field ( "search_start" , & components. search_start )
516
+ . field ( "hash_start" , & components. hash_start )
517
+ . finish ( )
518
+ }
517
519
}
518
520
}
519
521
@@ -577,7 +579,7 @@ mod test {
577
579
let tests = [ ( "https://www.ada-url.com/playground" ) ] ;
578
580
for value in tests {
579
581
let url = Url :: parse ( value, None ) . expect ( "Should have parsed url" ) ;
580
- println ! ( "{:?}" , url) ;
582
+ println ! ( "{:# ?}" , url) ;
581
583
}
582
584
}
583
585
0 commit comments