diff options
| author | Jiahao XU <Jiahao_XU@outlook.com> | 2025-03-08 00:36:15 +1100 |
|---|---|---|
| committer | Jiahao XU <Jiahao_XU@outlook.com> | 2025-03-14 01:03:56 +1100 |
| commit | 6863a99841f81ea18b9a26d053fd33a9700a8345 (patch) | |
| tree | 05ef90140466afcbd015a192087b516077ee1419 /library/std/src/io/pipe.rs | |
| parent | 340a45282ac8a076b0b058ac066a8872d78302b3 (diff) | |
| download | rust-6863a99841f81ea18b9a26d053fd33a9700a8345.tar.gz rust-6863a99841f81ea18b9a26d053fd33a9700a8345.zip | |
Mv os-specific trait impl of `Pipe*` into `std::os::*`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Diffstat (limited to 'library/std/src/io/pipe.rs')
| -rw-r--r-- | library/std/src/io/pipe.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/library/std/src/io/pipe.rs b/library/std/src/io/pipe.rs index 12ac62afb31..cfed9b05cc0 100644 --- a/library/std/src/io/pipe.rs +++ b/library/std/src/io/pipe.rs @@ -1,5 +1,6 @@ use crate::io; use crate::sys::anonymous_pipe::{AnonPipe, pipe as pipe_inner}; +use crate::sys_common::{FromInner, IntoInner}; /// Create an anonymous pipe. /// @@ -82,6 +83,30 @@ pub struct PipeReader(pub(crate) AnonPipe); #[derive(Debug)] pub struct PipeWriter(pub(crate) AnonPipe); +impl FromInner<AnonPipe> for PipeReader { + fn from_inner(inner: AnonPipe) -> Self { + Self(inner) + } +} + +impl IntoInner<AnonPipe> for PipeReader { + fn into_inner(self) -> AnonPipe { + self.0 + } +} + +impl FromInner<AnonPipe> for PipeWriter { + fn from_inner(inner: AnonPipe) -> Self { + Self(inner) + } +} + +impl IntoInner<AnonPipe> for PipeWriter { + fn into_inner(self) -> AnonPipe { + self.0 + } +} + impl PipeReader { /// Create a new [`PipeReader`] instance that shares the same underlying file description. /// |
