File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change 15
15
use fs;
16
16
use net;
17
17
use sys;
18
+ use io;
18
19
use sys_common:: { self , AsInner , FromInner , IntoInner } ;
19
20
20
21
/// Raw file descriptors.
@@ -109,6 +110,21 @@ impl AsRawFd for net::UdpSocket {
109
110
}
110
111
}
111
112
113
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
114
+ impl AsRawFd for io:: Stdin {
115
+ fn as_raw_fd ( & self ) -> RawFd { 0 }
116
+ }
117
+
118
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
119
+ impl AsRawFd for io:: Stdout {
120
+ fn as_raw_fd ( & self ) -> RawFd { 1 }
121
+ }
122
+
123
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
124
+ impl AsRawFd for io:: Stderr {
125
+ fn as_raw_fd ( & self ) -> RawFd { 2 }
126
+ }
127
+
112
128
#[ stable( feature = "from_raw_os" , since = "1.1.0" ) ]
113
129
impl FromRawFd for net:: TcpStream {
114
130
unsafe fn from_raw_fd ( fd : RawFd ) -> net:: TcpStream {
Original file line number Diff line number Diff line change @@ -16,7 +16,9 @@ use fs;
16
16
use net;
17
17
use os:: raw;
18
18
use sys;
19
+ use io;
19
20
use sys_common:: { self , AsInner , FromInner , IntoInner } ;
21
+ use libc;
20
22
21
23
/// Raw file descriptors.
22
24
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -104,6 +106,21 @@ impl AsRawFd for net::UdpSocket {
104
106
fn as_raw_fd ( & self ) -> RawFd { * self . as_inner ( ) . socket ( ) . as_inner ( ) }
105
107
}
106
108
109
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
110
+ impl AsRawFd for io:: Stdin {
111
+ fn as_raw_fd ( & self ) -> RawFd { libc:: STDIN_FILENO }
112
+ }
113
+
114
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
115
+ impl AsRawFd for io:: Stdout {
116
+ fn as_raw_fd ( & self ) -> RawFd { libc:: STDOUT_FILENO }
117
+ }
118
+
119
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
120
+ impl AsRawFd for io:: Stderr {
121
+ fn as_raw_fd ( & self ) -> RawFd { libc:: STDERR_FILENO }
122
+ }
123
+
107
124
#[ stable( feature = "from_raw_os" , since = "1.1.0" ) ]
108
125
impl FromRawFd for net:: TcpStream {
109
126
unsafe fn from_raw_fd ( fd : RawFd ) -> net:: TcpStream {
You can’t perform that action at this time.
0 commit comments