Skip to content

Commit

Permalink
Unrolled build for rust-lang#128303
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#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#127154
  • Loading branch information
rust-timer committed Aug 3, 2024
2 parents a604303 + 649b431 commit 42eb368
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions library/std/src/sys/pal/unix/kernel_copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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()))
Expand Down

0 comments on commit 42eb368

Please sign in to comment.