11use crate :: io;
22use crate :: sys:: anonymous_pipe:: { AnonPipe , pipe as pipe_inner} ;
3+ use crate :: sys_common:: { FromInner , IntoInner } ;
34
45/// Create an anonymous pipe.
56///
@@ -40,7 +41,6 @@ use crate::sys::anonymous_pipe::{AnonPipe, pipe as pipe_inner};
4041/// # Examples
4142///
4243/// ```no_run
43- /// #![feature(anonymous_pipe)]
4444/// # #[cfg(miri)] fn main() {}
4545/// # #[cfg(not(miri))]
4646/// # fn main() -> std::io::Result<()> {
@@ -67,29 +67,52 @@ use crate::sys::anonymous_pipe::{AnonPipe, pipe as pipe_inner};
6767/// ```
6868/// [changes]: io#platform-specific-behavior
6969/// [man page]: https://man7.org/linux/man-pages/man7/pipe.7.html
70- #[ unstable ( feature = "anonymous_pipe" , issue = "127154 " ) ]
70+ #[ stable ( feature = "anonymous_pipe" , since = "CURRENT_RUSTC_VERSION " ) ]
7171#[ inline]
7272pub fn pipe ( ) -> io:: Result < ( PipeReader , PipeWriter ) > {
7373 pipe_inner ( ) . map ( |( reader, writer) | ( PipeReader ( reader) , PipeWriter ( writer) ) )
7474}
7575
7676/// Read end of an anonymous pipe.
77- #[ unstable ( feature = "anonymous_pipe" , issue = "127154 " ) ]
77+ #[ stable ( feature = "anonymous_pipe" , since = "CURRENT_RUSTC_VERSION " ) ]
7878#[ derive( Debug ) ]
7979pub struct PipeReader ( pub ( crate ) AnonPipe ) ;
8080
8181/// Write end of an anonymous pipe.
82- #[ unstable ( feature = "anonymous_pipe" , issue = "127154 " ) ]
82+ #[ stable ( feature = "anonymous_pipe" , since = "CURRENT_RUSTC_VERSION " ) ]
8383#[ derive( Debug ) ]
8484pub struct PipeWriter ( pub ( crate ) AnonPipe ) ;
8585
86+ impl FromInner < AnonPipe > for PipeReader {
87+ fn from_inner ( inner : AnonPipe ) -> Self {
88+ Self ( inner)
89+ }
90+ }
91+
92+ impl IntoInner < AnonPipe > for PipeReader {
93+ fn into_inner ( self ) -> AnonPipe {
94+ self . 0
95+ }
96+ }
97+
98+ impl FromInner < AnonPipe > for PipeWriter {
99+ fn from_inner ( inner : AnonPipe ) -> Self {
100+ Self ( inner)
101+ }
102+ }
103+
104+ impl IntoInner < AnonPipe > for PipeWriter {
105+ fn into_inner ( self ) -> AnonPipe {
106+ self . 0
107+ }
108+ }
109+
86110impl PipeReader {
87111 /// Create a new [`PipeReader`] instance that shares the same underlying file description.
88112 ///
89113 /// # Examples
90114 ///
91115 /// ```no_run
92- /// #![feature(anonymous_pipe)]
93116 /// # #[cfg(miri)] fn main() {}
94117 /// # #[cfg(not(miri))]
95118 /// # fn main() -> std::io::Result<()> {
@@ -137,7 +160,7 @@ impl PipeReader {
137160 /// # Ok(())
138161 /// # }
139162 /// ```
140- #[ unstable ( feature = "anonymous_pipe" , issue = "127154 " ) ]
163+ #[ stable ( feature = "anonymous_pipe" , since = "CURRENT_RUSTC_VERSION " ) ]
141164 pub fn try_clone ( & self ) -> io:: Result < Self > {
142165 self . 0 . try_clone ( ) . map ( Self )
143166 }
@@ -149,7 +172,6 @@ impl PipeWriter {
149172 /// # Examples
150173 ///
151174 /// ```no_run
152- /// #![feature(anonymous_pipe)]
153175 /// # #[cfg(miri)] fn main() {}
154176 /// # #[cfg(not(miri))]
155177 /// # fn main() -> std::io::Result<()> {
@@ -177,13 +199,13 @@ impl PipeWriter {
177199 /// # Ok(())
178200 /// # }
179201 /// ```
180- #[ unstable ( feature = "anonymous_pipe" , issue = "127154 " ) ]
202+ #[ stable ( feature = "anonymous_pipe" , since = "CURRENT_RUSTC_VERSION " ) ]
181203 pub fn try_clone ( & self ) -> io:: Result < Self > {
182204 self . 0 . try_clone ( ) . map ( Self )
183205 }
184206}
185207
186- #[ unstable ( feature = "anonymous_pipe" , issue = "127154 " ) ]
208+ #[ stable ( feature = "anonymous_pipe" , since = "CURRENT_RUSTC_VERSION " ) ]
187209impl io:: Read for & PipeReader {
188210 fn read ( & mut self , buf : & mut [ u8 ] ) -> io:: Result < usize > {
189211 self . 0 . read ( buf)
@@ -203,7 +225,7 @@ impl io::Read for &PipeReader {
203225 }
204226}
205227
206- #[ unstable ( feature = "anonymous_pipe" , issue = "127154 " ) ]
228+ #[ stable ( feature = "anonymous_pipe" , since = "CURRENT_RUSTC_VERSION " ) ]
207229impl io:: Read for PipeReader {
208230 fn read ( & mut self , buf : & mut [ u8 ] ) -> io:: Result < usize > {
209231 self . 0 . read ( buf)
@@ -223,7 +245,7 @@ impl io::Read for PipeReader {
223245 }
224246}
225247
226- #[ unstable ( feature = "anonymous_pipe" , issue = "127154 " ) ]
248+ #[ stable ( feature = "anonymous_pipe" , since = "CURRENT_RUSTC_VERSION " ) ]
227249impl io:: Write for & PipeWriter {
228250 fn write ( & mut self , buf : & [ u8 ] ) -> io:: Result < usize > {
229251 self . 0 . write ( buf)
@@ -241,7 +263,7 @@ impl io::Write for &PipeWriter {
241263 }
242264}
243265
244- #[ unstable ( feature = "anonymous_pipe" , issue = "127154 " ) ]
266+ #[ stable ( feature = "anonymous_pipe" , since = "CURRENT_RUSTC_VERSION " ) ]
245267impl io:: Write for PipeWriter {
246268 fn write ( & mut self , buf : & [ u8 ] ) -> io:: Result < usize > {
247269 self . 0 . write ( buf)
0 commit comments