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 1515use  fs; 
1616use  net; 
1717use  sys; 
18+ use  io; 
1819use  sys_common:: { self ,  AsInner ,  FromInner ,  IntoInner } ; 
1920
2021/// Raw file descriptors. 
@@ -109,6 +110,21 @@ impl AsRawFd for net::UdpSocket {
109110    } 
110111} 
111112
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+ 
112128#[ stable( feature = "from_raw_os" ,  since = "1.1.0" ) ]  
113129impl  FromRawFd  for  net:: TcpStream  { 
114130    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;
1616use  net; 
1717use  os:: raw; 
1818use  sys; 
19+ use  io; 
1920use  sys_common:: { self ,  AsInner ,  FromInner ,  IntoInner } ; 
21+ use  libc; 
2022
2123/// Raw file descriptors. 
2224#[ stable( feature = "rust1" ,  since = "1.0.0" ) ]  
@@ -104,6 +106,21 @@ impl AsRawFd for net::UdpSocket {
104106    fn  as_raw_fd ( & self )  -> RawFd  {  * self . as_inner ( ) . socket ( ) . as_inner ( )  } 
105107} 
106108
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+ 
107124#[ stable( feature = "from_raw_os" ,  since = "1.1.0" ) ]  
108125impl  FromRawFd  for  net:: TcpStream  { 
109126    unsafe  fn  from_raw_fd ( fd :  RawFd )  -> net:: TcpStream  { 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments