about summary refs log tree commit diff
path: root/src/libstd/sys/unix/ext.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstd/sys/unix/ext.rs')
-rw-r--r--src/libstd/sys/unix/ext.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/libstd/sys/unix/ext.rs b/src/libstd/sys/unix/ext.rs
index 689bbda8322..1d95f1cce7e 100644
--- a/src/libstd/sys/unix/ext.rs
+++ b/src/libstd/sys/unix/ext.rs
@@ -32,8 +32,8 @@
 #![unstable(feature = "std_misc")]
 
 use ffi::{OsStr, OsString};
-use fs::{Permissions, OpenOptions};
-use fs;
+use fs::{self, Permissions, OpenOptions};
+use net;
 use libc;
 use mem;
 use sys::os_str::Buf;
@@ -111,6 +111,16 @@ impl AsRawFd for old_io::net::udp::UdpSocket {
     }
 }
 
+impl AsRawFd for net::TcpStream {
+    fn as_raw_fd(&self) -> Fd { *self.as_inner().socket().as_inner() }
+}
+impl AsRawFd for net::TcpListener {
+    fn as_raw_fd(&self) -> Fd { *self.as_inner().socket().as_inner() }
+}
+impl AsRawFd for net::UdpSocket {
+    fn as_raw_fd(&self) -> Fd { *self.as_inner().socket().as_inner() }
+}
+
 // Unix-specific extensions to `OsString`.
 pub trait OsStringExt {
     /// Create an `OsString` from a byte vector.