diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-08-03 11:17:43 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-03 11:17:43 +0200 |
| commit | 95d9f1c4abd75b0ca43cdc2ed5b21e4e32a859a3 (patch) | |
| tree | 76822eb796c01da18f609a7c8dae0c61313b7bd9 | |
| parent | 47a795bbd318f7ea51c023e3219cfe923cf8a85a (diff) | |
| parent | 649b4310a3f0913a72e6a83cb54482d994ed248a (diff) | |
| download | rust-95d9f1c4abd75b0ca43cdc2ed5b21e4e32a859a3.tar.gz rust-95d9f1c4abd75b0ca43cdc2ed5b21e4e32a859a3.zip | |
Rollup merge of #128303 - NobodyXu:specialise-for-pipe, r=cuviper
Enable `std::io::copy` specialisation for `std::pipe::{PipeReader, PipeWriter}`
Enable `std::io::copy` specialisation on unix for the newly added anonymous pipe API, tracking issue rust-lang/rust#127154
| -rw-r--r-- | library/std/src/sys/pal/unix/kernel_copy.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/library/std/src/sys/pal/unix/kernel_copy.rs b/library/std/src/sys/pal/unix/kernel_copy.rs index 652b2e1feb7..a671383cb79 100644 --- a/library/std/src/sys/pal/unix/kernel_copy.rs +++ b/library/std/src/sys/pal/unix/kernel_copy.rs @@ -60,6 +60,7 @@ use crate::net::TcpStream; use crate::os::unix::fs::FileTypeExt; use crate::os::unix::io::{AsRawFd, FromRawFd, RawFd}; use crate::os::unix::net::UnixStream; +use crate::pipe::{PipeReader, PipeWriter}; use crate::process::{ChildStderr, ChildStdin, ChildStdout}; use crate::ptr; use crate::sync::atomic::{AtomicBool, AtomicU8, Ordering}; @@ -405,6 +406,30 @@ impl CopyWrite for &UnixStream { } } +impl CopyRead for PipeReader { + fn properties(&self) -> CopyParams { + CopyParams(FdMeta::Pipe, Some(self.as_raw_fd())) + } +} + +impl CopyRead for &PipeReader { + fn properties(&self) -> CopyParams { + CopyParams(FdMeta::Pipe, Some(self.as_raw_fd())) + } +} + +impl CopyWrite for PipeWriter { + fn properties(&self) -> CopyParams { + CopyParams(FdMeta::Pipe, Some(self.as_raw_fd())) + } +} + +impl CopyWrite for &PipeWriter { + fn properties(&self) -> CopyParams { + CopyParams(FdMeta::Pipe, Some(self.as_raw_fd())) + } +} + impl CopyWrite for ChildStdin { fn properties(&self) -> CopyParams { CopyParams(FdMeta::Pipe, Some(self.as_raw_fd())) |
