1+ #[ expect( dead_code) ]
2+ #[ path = "unsupported.rs" ]
3+ mod unsupported_env;
4+ pub use unsupported_env:: { Env , env, setenv, unsetenv} ;
5+
16use crate :: ffi:: { OsStr , OsString } ;
27use crate :: sys:: os_str;
38use crate :: sys:: pal:: { WORD_SIZE , abi} ;
49use crate :: sys_common:: FromInner ;
5- use crate :: { fmt, io} ;
6-
7- pub struct Env ( !) ;
8-
9- impl Iterator for Env {
10- type Item = ( OsString , OsString ) ;
11- fn next ( & mut self ) -> Option < ( OsString , OsString ) > {
12- self . 0
13- }
14- }
15-
16- pub fn env ( ) -> Env {
17- panic ! ( "not supported on this platform" )
18- }
19-
20- impl Env {
21- pub fn str_debug ( & self ) -> impl fmt:: Debug + ' _ {
22- let Self ( inner) = self ;
23- match * inner { }
24- }
25- }
26-
27- impl fmt:: Debug for Env {
28- fn fmt ( & self , _: & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
29- let Self ( inner) = self ;
30- match * inner { }
31- }
32- }
3310
3411pub fn getenv ( varname : & OsStr ) -> Option < OsString > {
3512 let varname = varname. as_encoded_bytes ( ) ;
@@ -53,11 +30,3 @@ pub fn getenv(varname: &OsStr) -> Option<OsString> {
5330 let u8s: & [ u8 ] = unsafe { crate :: slice:: from_raw_parts ( words. cast ( ) as * const u8 , nbytes) } ;
5431 Some ( OsString :: from_inner ( os_str:: Buf { inner : u8s. to_vec ( ) } ) )
5532}
56-
57- pub unsafe fn setenv ( _: & OsStr , _: & OsStr ) -> io:: Result < ( ) > {
58- Err ( io:: const_error!( io:: ErrorKind :: Unsupported , "cannot set env vars on this platform" ) )
59- }
60-
61- pub unsafe fn unsetenv ( _: & OsStr ) -> io:: Result < ( ) > {
62- Err ( io:: const_error!( io:: ErrorKind :: Unsupported , "cannot unset env vars on this platform" ) )
63- }
0 commit comments