@@ -168,7 +168,13 @@ use crate::host::HostInternal;
168
168
169
169
use crate :: net:: IpAddr ;
170
170
#[ cfg( feature = "std" ) ]
171
- #[ cfg( any( unix, windows, target_os = "redox" , target_os = "wasi" ) ) ]
171
+ #[ cfg( any(
172
+ unix,
173
+ windows,
174
+ target_os = "redox" ,
175
+ target_os = "wasi" ,
176
+ target_os = "hermit"
177
+ ) ) ]
172
178
use crate :: net:: { SocketAddr , ToSocketAddrs } ;
173
179
use crate :: parser:: { to_u32, Context , Parser , SchemeType , USERINFO } ;
174
180
use alloc:: borrow:: ToOwned ;
@@ -181,7 +187,13 @@ use core::ops::{Range, RangeFrom, RangeTo};
181
187
use core:: { cmp, fmt, hash, mem} ;
182
188
use percent_encoding:: utf8_percent_encode;
183
189
#[ cfg( feature = "std" ) ]
184
- #[ cfg( any( unix, windows, target_os = "redox" , target_os = "wasi" ) ) ]
190
+ #[ cfg( any(
191
+ unix,
192
+ windows,
193
+ target_os = "redox" ,
194
+ target_os = "wasi" ,
195
+ target_os = "hermit"
196
+ ) ) ]
185
197
use std:: io;
186
198
#[ cfg( feature = "std" ) ]
187
199
use std:: path:: { Path , PathBuf } ;
@@ -1308,7 +1320,13 @@ impl Url {
1308
1320
/// }
1309
1321
/// ```
1310
1322
#[ cfg( feature = "std" ) ]
1311
- #[ cfg( any( unix, windows, target_os = "redox" , target_os = "wasi" ) ) ]
1323
+ #[ cfg( any(
1324
+ unix,
1325
+ windows,
1326
+ target_os = "redox" ,
1327
+ target_os = "wasi" ,
1328
+ target_os = "hermit"
1329
+ ) ) ]
1312
1330
pub fn socket_addrs (
1313
1331
& self ,
1314
1332
default_port_number : impl Fn ( ) -> Option < u16 > ,
@@ -2566,7 +2584,13 @@ impl Url {
2566
2584
/// This method is only available if the `std` Cargo feature is enabled.
2567
2585
#[ cfg( all(
2568
2586
feature = "std" ,
2569
- any( unix, windows, target_os = "redox" , target_os = "wasi" )
2587
+ any(
2588
+ unix,
2589
+ windows,
2590
+ target_os = "redox" ,
2591
+ target_os = "wasi" ,
2592
+ target_os = "hermit"
2593
+ )
2570
2594
) ) ]
2571
2595
#[ allow( clippy:: result_unit_err) ]
2572
2596
pub fn from_file_path < P : AsRef < std:: path:: Path > > ( path : P ) -> Result < Url , ( ) > {
@@ -2608,7 +2632,13 @@ impl Url {
2608
2632
/// This method is only available if the `std` Cargo feature is enabled.
2609
2633
#[ cfg( all(
2610
2634
feature = "std" ,
2611
- any( unix, windows, target_os = "redox" , target_os = "wasi" )
2635
+ any(
2636
+ unix,
2637
+ windows,
2638
+ target_os = "redox" ,
2639
+ target_os = "wasi" ,
2640
+ target_os = "hermit"
2641
+ )
2612
2642
) ) ]
2613
2643
#[ allow( clippy:: result_unit_err) ]
2614
2644
pub fn from_directory_path < P : AsRef < std:: path:: Path > > ( path : P ) -> Result < Url , ( ) > {
@@ -2730,7 +2760,13 @@ impl Url {
2730
2760
#[ inline]
2731
2761
#[ cfg( all(
2732
2762
feature = "std" ,
2733
- any( unix, windows, target_os = "redox" , target_os = "wasi" )
2763
+ any(
2764
+ unix,
2765
+ windows,
2766
+ target_os = "redox" ,
2767
+ target_os = "wasi" ,
2768
+ target_os = "hermit"
2769
+ )
2734
2770
) ) ]
2735
2771
#[ allow( clippy:: result_unit_err) ]
2736
2772
pub fn to_file_path ( & self ) -> Result < PathBuf , ( ) > {
@@ -2935,13 +2971,18 @@ impl<'de> serde::Deserialize<'de> for Url {
2935
2971
}
2936
2972
}
2937
2973
2938
- #[ cfg( all( feature = "std" , any( unix, target_os = "redox" , target_os = "wasi" ) ) ) ]
2974
+ #[ cfg( all(
2975
+ feature = "std" ,
2976
+ any( unix, target_os = "redox" , target_os = "wasi" , target_os = "hermit" )
2977
+ ) ) ]
2939
2978
fn path_to_file_url_segments (
2940
2979
path : & Path ,
2941
2980
serialization : & mut String ,
2942
2981
) -> Result < ( u32 , HostInternal ) , ( ) > {
2943
2982
use parser:: SPECIAL_PATH_SEGMENT ;
2944
2983
use percent_encoding:: percent_encode;
2984
+ #[ cfg( target_os = "hermit" ) ]
2985
+ use std:: os:: hermit:: ffi:: OsStrExt ;
2945
2986
#[ cfg( any( unix, target_os = "redox" ) ) ]
2946
2987
use std:: os:: unix:: prelude:: OsStrExt ;
2947
2988
#[ cfg( target_os = "wasi" ) ]
@@ -3042,14 +3083,19 @@ fn path_to_file_url_segments_windows(
3042
3083
Ok ( ( host_end, host_internal) )
3043
3084
}
3044
3085
3045
- #[ cfg( all( feature = "std" , any( unix, target_os = "redox" , target_os = "wasi" ) ) ) ]
3086
+ #[ cfg( all(
3087
+ feature = "std" ,
3088
+ any( unix, target_os = "redox" , target_os = "wasi" , target_os = "hermit" )
3089
+ ) ) ]
3046
3090
fn file_url_segments_to_pathbuf (
3047
3091
host : Option < & str > ,
3048
3092
segments : str:: Split < ' _ , char > ,
3049
3093
) -> Result < PathBuf , ( ) > {
3050
3094
use alloc:: vec:: Vec ;
3051
3095
use percent_encoding:: percent_decode;
3052
3096
use std:: ffi:: OsStr ;
3097
+ #[ cfg( target_os = "hermit" ) ]
3098
+ use std:: os:: hermit:: ffi:: OsStrExt ;
3053
3099
#[ cfg( any( unix, target_os = "redox" ) ) ]
3054
3100
use std:: os:: unix:: prelude:: OsStrExt ;
3055
3101
#[ cfg( target_os = "wasi" ) ]
0 commit comments