about summary refs log tree commit diff
path: root/library/std/src/os/fd/raw.rs
diff options
context:
space:
mode:
Diffstat (limited to 'library/std/src/os/fd/raw.rs')
-rw-r--r--library/std/src/os/fd/raw.rs43
1 files changed, 43 insertions, 0 deletions
diff --git a/library/std/src/os/fd/raw.rs b/library/std/src/os/fd/raw.rs
index 083ac6e3fe6..596b21a5204 100644
--- a/library/std/src/os/fd/raw.rs
+++ b/library/std/src/os/fd/raw.rs
@@ -18,6 +18,7 @@ use crate::os::unix::io::AsFd;
 use crate::os::unix::io::OwnedFd;
 #[cfg(target_os = "wasi")]
 use crate::os::wasi::io::OwnedFd;
+use crate::sys_common::FromInner;
 #[cfg(not(target_os = "trusty"))]
 use crate::sys_common::{AsInner, IntoInner};
 
@@ -284,3 +285,45 @@ impl<T: AsRawFd> AsRawFd for Box<T> {
         (**self).as_raw_fd()
     }
 }
+
+#[stable(feature = "anonymous_pipe", since = "CURRENT_RUSTC_VERSION")]
+impl AsRawFd for io::PipeReader {
+    fn as_raw_fd(&self) -> RawFd {
+        self.0.as_raw_fd()
+    }
+}
+
+#[stable(feature = "anonymous_pipe", since = "CURRENT_RUSTC_VERSION")]
+impl FromRawFd for io::PipeReader {
+    unsafe fn from_raw_fd(raw_fd: RawFd) -> Self {
+        Self::from_inner(unsafe { FromRawFd::from_raw_fd(raw_fd) })
+    }
+}
+
+#[stable(feature = "anonymous_pipe", since = "CURRENT_RUSTC_VERSION")]
+impl IntoRawFd for io::PipeReader {
+    fn into_raw_fd(self) -> RawFd {
+        self.0.into_raw_fd()
+    }
+}
+
+#[stable(feature = "anonymous_pipe", since = "CURRENT_RUSTC_VERSION")]
+impl AsRawFd for io::PipeWriter {
+    fn as_raw_fd(&self) -> RawFd {
+        self.0.as_raw_fd()
+    }
+}
+
+#[stable(feature = "anonymous_pipe", since = "CURRENT_RUSTC_VERSION")]
+impl FromRawFd for io::PipeWriter {
+    unsafe fn from_raw_fd(raw_fd: RawFd) -> Self {
+        Self::from_inner(unsafe { FromRawFd::from_raw_fd(raw_fd) })
+    }
+}
+
+#[stable(feature = "anonymous_pipe", since = "CURRENT_RUSTC_VERSION")]
+impl IntoRawFd for io::PipeWriter {
+    fn into_raw_fd(self) -> RawFd {
+        self.0.into_raw_fd()
+    }
+}