1
+ #[ expect( dead_code) ]
2
+ #[ path = "unsupported.rs" ]
3
+ mod unsupported_env;
4
+ pub use unsupported_env:: { Env , env, setenv, unsetenv} ;
5
+
1
6
use crate :: ffi:: { OsStr , OsString } ;
2
7
use crate :: sys:: os_str;
3
8
use crate :: sys:: pal:: { WORD_SIZE , abi} ;
4
9
use 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
- }
33
10
34
11
pub fn getenv ( varname : & OsStr ) -> Option < OsString > {
35
12
let varname = varname. as_encoded_bytes ( ) ;
@@ -53,11 +30,3 @@ pub fn getenv(varname: &OsStr) -> Option<OsString> {
53
30
let u8s: & [ u8 ] = unsafe { crate :: slice:: from_raw_parts ( words. cast ( ) as * const u8 , nbytes) } ;
54
31
Some ( OsString :: from_inner ( os_str:: Buf { inner : u8s. to_vec ( ) } ) )
55
32
}
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