@@ -23,14 +23,14 @@ pub mod terminalsource;
2323/// Allows concrete types for the currentprocess abstraction.
2424#[ derive( Clone , Debug ) ]
2525pub enum Process {
26- OSProcess ( OSProcess ) ,
26+ Os ( OSProcess ) ,
2727 #[ cfg( feature = "test" ) ]
28- TestProcess ( TestProcess ) ,
28+ Test ( TestProcess ) ,
2929}
3030
3131impl Process {
3232 pub fn os ( ) -> Self {
33- Self :: OSProcess ( OSProcess :: new ( ) )
33+ Self :: Os ( OSProcess :: new ( ) )
3434 }
3535
3636 pub fn name ( & self ) -> Option < String > {
@@ -48,9 +48,9 @@ impl Process {
4848
4949 pub fn var ( & self , key : & str ) -> Result < String , env:: VarError > {
5050 match self {
51- Process :: OSProcess ( _) => env:: var ( key) ,
51+ Process :: Os ( _) => env:: var ( key) ,
5252 #[ cfg( feature = "test" ) ]
53- Process :: TestProcess ( p) => match p. vars . get ( key) {
53+ Process :: Test ( p) => match p. vars . get ( key) {
5454 Some ( val) => Ok ( val. to_owned ( ) ) ,
5555 None => Err ( env:: VarError :: NotPresent ) ,
5656 } ,
@@ -59,100 +59,100 @@ impl Process {
5959
6060 pub ( crate ) fn var_os ( & self , key : & str ) -> Option < OsString > {
6161 match self {
62- Process :: OSProcess ( _) => env:: var_os ( key) ,
62+ Process :: Os ( _) => env:: var_os ( key) ,
6363 #[ cfg( feature = "test" ) ]
64- Process :: TestProcess ( p) => p. vars . get ( key) . map ( OsString :: from) ,
64+ Process :: Test ( p) => p. vars . get ( key) . map ( OsString :: from) ,
6565 }
6666 }
6767
6868 pub ( crate ) fn args ( & self ) -> Box < dyn Iterator < Item = String > + ' _ > {
6969 match self {
70- Process :: OSProcess ( _) => Box :: new ( env:: args ( ) ) ,
70+ Process :: Os ( _) => Box :: new ( env:: args ( ) ) ,
7171 #[ cfg( feature = "test" ) ]
72- Process :: TestProcess ( p) => Box :: new ( p. args . iter ( ) . cloned ( ) ) ,
72+ Process :: Test ( p) => Box :: new ( p. args . iter ( ) . cloned ( ) ) ,
7373 }
7474 }
7575
7676 pub ( crate ) fn args_os ( & self ) -> Box < dyn Iterator < Item = OsString > + ' _ > {
7777 match self {
78- Process :: OSProcess ( _) => Box :: new ( env:: args_os ( ) ) ,
78+ Process :: Os ( _) => Box :: new ( env:: args_os ( ) ) ,
7979 #[ cfg( feature = "test" ) ]
80- Process :: TestProcess ( p) => Box :: new ( p. args . iter ( ) . map ( OsString :: from) ) ,
80+ Process :: Test ( p) => Box :: new ( p. args . iter ( ) . map ( OsString :: from) ) ,
8181 }
8282 }
8383
8484 pub ( crate ) fn stdin ( & self ) -> Box < dyn filesource:: Stdin > {
8585 match self {
86- Process :: OSProcess ( _) => Box :: new ( io:: stdin ( ) ) ,
86+ Process :: Os ( _) => Box :: new ( io:: stdin ( ) ) ,
8787 #[ cfg( feature = "test" ) ]
88- Process :: TestProcess ( p) => Box :: new ( filesource:: TestStdin ( p. stdin . clone ( ) ) ) ,
88+ Process :: Test ( p) => Box :: new ( filesource:: TestStdin ( p. stdin . clone ( ) ) ) ,
8989 }
9090 }
9191
9292 pub ( crate ) fn stdout ( & self ) -> Box < dyn filesource:: Writer > {
9393 match self {
94- Process :: OSProcess ( _) => Box :: new ( io:: stdout ( ) ) ,
94+ Process :: Os ( _) => Box :: new ( io:: stdout ( ) ) ,
9595 #[ cfg( feature = "test" ) ]
96- Process :: TestProcess ( p) => Box :: new ( filesource:: TestWriter ( p. stdout . clone ( ) ) ) ,
96+ Process :: Test ( p) => Box :: new ( filesource:: TestWriter ( p. stdout . clone ( ) ) ) ,
9797 }
9898 }
9999
100100 pub ( crate ) fn stderr ( & self ) -> Box < dyn filesource:: Writer > {
101101 match self {
102- Process :: OSProcess ( _) => Box :: new ( io:: stderr ( ) ) ,
102+ Process :: Os ( _) => Box :: new ( io:: stderr ( ) ) ,
103103 #[ cfg( feature = "test" ) ]
104- Process :: TestProcess ( p) => Box :: new ( filesource:: TestWriter ( p. stderr . clone ( ) ) ) ,
104+ Process :: Test ( p) => Box :: new ( filesource:: TestWriter ( p. stderr . clone ( ) ) ) ,
105105 }
106106 }
107107
108108 pub ( crate ) fn current_dir ( & self ) -> io:: Result < PathBuf > {
109109 match self {
110- Process :: OSProcess ( _) => env:: current_dir ( ) ,
110+ Process :: Os ( _) => env:: current_dir ( ) ,
111111 #[ cfg( feature = "test" ) ]
112- Process :: TestProcess ( p) => Ok ( p. cwd . clone ( ) ) ,
112+ Process :: Test ( p) => Ok ( p. cwd . clone ( ) ) ,
113113 }
114114 }
115115
116116 #[ cfg( test) ]
117117 fn id ( & self ) -> u64 {
118118 match self {
119- Process :: OSProcess ( _) => std:: process:: id ( ) as u64 ,
119+ Process :: Os ( _) => std:: process:: id ( ) as u64 ,
120120 #[ cfg( feature = "test" ) ]
121- Process :: TestProcess ( p) => p. id ,
121+ Process :: Test ( p) => p. id ,
122122 }
123123 }
124124}
125125
126126impl home:: env:: Env for Process {
127127 fn home_dir ( & self ) -> Option < PathBuf > {
128128 match self {
129- Process :: OSProcess ( _) => self . var ( "HOME" ) . ok ( ) . map ( |v| v. into ( ) ) ,
129+ Process :: Os ( _) => self . var ( "HOME" ) . ok ( ) . map ( |v| v. into ( ) ) ,
130130 #[ cfg( feature = "test" ) ]
131- Process :: TestProcess ( _) => home:: env:: OS_ENV . home_dir ( ) ,
131+ Process :: Test ( _) => home:: env:: OS_ENV . home_dir ( ) ,
132132 }
133133 }
134134
135135 fn current_dir ( & self ) -> Result < PathBuf , io:: Error > {
136136 match self {
137- Process :: OSProcess ( _) => self . current_dir ( ) ,
137+ Process :: Os ( _) => self . current_dir ( ) ,
138138 #[ cfg( feature = "test" ) ]
139- Process :: TestProcess ( _) => home:: env:: OS_ENV . current_dir ( ) ,
139+ Process :: Test ( _) => home:: env:: OS_ENV . current_dir ( ) ,
140140 }
141141 }
142142
143143 fn var_os ( & self , key : & str ) -> Option < OsString > {
144144 match self {
145- Process :: OSProcess ( _) => self . var_os ( key) ,
145+ Process :: Os ( _) => self . var_os ( key) ,
146146 #[ cfg( feature = "test" ) ]
147- Process :: TestProcess ( _) => self . var_os ( key) ,
147+ Process :: Test ( _) => self . var_os ( key) ,
148148 }
149149 }
150150}
151151
152152#[ cfg( feature = "test" ) ]
153153impl From < TestProcess > for Process {
154154 fn from ( p : TestProcess ) -> Self {
155- Self :: TestProcess ( p)
155+ Self :: Test ( p)
156156 }
157157}
158158
0 commit comments