@@ -261,21 +261,6 @@ pub struct StdinLock<'a> {
261261 inner : MutexGuard < ' a , BufReader < StdinRaw > > ,
262262}
263263
264- /// Owned locked [`Stdin`] handle, returned by [`Stdin::into_lock`] and
265- /// [`io::stdin_locked`].
266- ///
267- /// This is exactly like [`StdinLock`], except that it can outlive the
268- /// [`Stdin`] handle that was used to create it. See the [`StdinLock`]
269- /// documentation for more details.
270- ///
271- /// ### Note: Windows Portability Consideration
272- ///
273- /// When operating in a console, the Windows implementation of this stream does not support
274- /// non-UTF-8 byte sequences. Attempting to read bytes that are not valid UTF-8 will return
275- /// an error.
276- #[ unstable( feature = "stdio_locked" , issue = "none" ) ]
277- pub type StdinOwnedLock = StdinLock < ' static > ;
278-
279264/// Constructs a new handle to the standard input of the current process.
280265///
281266/// Each handle returned is a reference to a shared global buffer whose access
@@ -363,8 +348,8 @@ pub fn stdin() -> Stdin {
363348/// }
364349/// ```
365350#[ unstable( feature = "stdio_locked" , issue = "none" ) ]
366- pub fn stdin_locked ( ) -> StdinOwnedLock {
367- stdin ( ) . into_lock ( )
351+ pub fn stdin_locked ( ) -> StdinLock < ' static > {
352+ stdin ( ) . into_locked ( )
368353}
369354
370355impl Stdin {
@@ -451,14 +436,14 @@ impl Stdin {
451436 ///
452437 /// fn main() -> io::Result<()> {
453438 /// let mut buffer = String::new();
454- /// let mut handle = io::stdin().into_lock ();
439+ /// let mut handle = io::stdin().into_locked ();
455440 ///
456441 /// handle.read_to_string(&mut buffer)?;
457442 /// Ok(())
458443 /// }
459444 /// ```
460445 #[ unstable( feature = "stdio_locked" , issue = "none" ) ]
461- pub fn into_lock ( self ) -> StdinOwnedLock {
446+ pub fn into_locked ( self ) -> StdinLock < ' static > {
462447 self . lock_any ( )
463448 }
464449}
@@ -601,20 +586,6 @@ pub struct StdoutLock<'a> {
601586 inner : ReentrantMutexGuard < ' a , RefCell < LineWriter < StdoutRaw > > > ,
602587}
603588
604- /// Owned locked [`Stdout`] handle, returned by [`Stdout::into_lock`] and
605- /// [`io::stdout_locked`].
606- ///
607- /// This is exactly like [`StdoutLock`], except that it can outlive the
608- /// [`Stdout`] handle that was used to create it. See the [`StdoutLock`]
609- /// documentation for more details.
610- ///
611- /// ### Note: Windows Portability Consideration
612- /// When operating in a console, the Windows implementation of this stream does not support
613- /// non-UTF-8 byte sequences. Attempting to write bytes that are not valid UTF-8 will return
614- /// an error.
615- #[ unstable( feature = "stdio_locked" , issue = "none" ) ]
616- pub type StdoutOwnedLock = StdoutLock < ' static > ;
617-
618589static STDOUT : SyncOnceCell < ReentrantMutex < RefCell < LineWriter < StdoutRaw > > > > = SyncOnceCell :: new ( ) ;
619590
620591/// Constructs a new handle to the standard output of the current process.
@@ -699,7 +670,7 @@ pub fn stdout() -> Stdout {
699670/// ```
700671#[ unstable( feature = "stdio_locked" , issue = "none" ) ]
701672pub fn stdout_locked ( ) -> StdoutLock < ' static > {
702- stdout ( ) . into_lock ( )
673+ stdout ( ) . into_locked ( )
703674}
704675
705676pub fn cleanup ( ) {
@@ -767,15 +738,15 @@ impl Stdout {
767738 /// use std::io::{self, Write};
768739 ///
769740 /// fn main() -> io::Result<()> {
770- /// let mut handle = io::stdout().into_lock ();
741+ /// let mut handle = io::stdout().into_locked ();
771742 ///
772743 /// handle.write_all(b"hello world")?;
773744 ///
774745 /// Ok(())
775746 /// }
776747 /// ```
777748 #[ unstable( feature = "stdio_locked" , issue = "none" ) ]
778- pub fn into_lock ( self ) -> StdoutOwnedLock {
749+ pub fn into_locked ( self ) -> StdoutLock < ' static > {
779750 self . lock_any ( )
780751 }
781752}
@@ -898,20 +869,6 @@ pub struct StderrLock<'a> {
898869 inner : ReentrantMutexGuard < ' a , RefCell < StderrRaw > > ,
899870}
900871
901- /// Owned locked [`Stderr`] handle, returned by [`Stderr::into_lock`] and
902- /// [`io::stderr_locked`].
903- ///
904- /// This is exactly like [`StderrLock`], except that it can outlive the the
905- /// [`Stderr`] handle that was used to create it. See the [`StderrLock`]
906- /// documentation for more details.
907- ///
908- /// ### Note: Windows Portability Consideration
909- /// When operating in a console, the Windows implementation of this stream does not support
910- /// non-UTF-8 byte sequences. Attempting to write bytes that are not valid UTF-8 will return
911- /// an error.
912- #[ unstable( feature = "stdio_locked" , issue = "none" ) ]
913- pub type StderrOwnedLock = StderrLock < ' static > ;
914-
915872/// Constructs a new handle to the standard error of the current process.
916873///
917874/// This handle is not buffered.
@@ -989,8 +946,8 @@ pub fn stderr() -> Stderr {
989946/// }
990947/// ```
991948#[ unstable( feature = "stdio_locked" , issue = "none" ) ]
992- pub fn stderr_locked ( ) -> StderrOwnedLock {
993- stderr ( ) . into_lock ( )
949+ pub fn stderr_locked ( ) -> StderrLock < ' static > {
950+ stderr ( ) . into_locked ( )
994951}
995952
996953impl Stderr {
@@ -1041,15 +998,15 @@ impl Stderr {
1041998 ///
1042999 /// fn foo() -> io::Result<()> {
10431000 /// let stderr = io::stderr();
1044- /// let mut handle = stderr.into_lock ();
1001+ /// let mut handle = stderr.into_locked ();
10451002 ///
10461003 /// handle.write_all(b"hello world")?;
10471004 ///
10481005 /// Ok(())
10491006 /// }
10501007 /// ```
10511008 #[ unstable( feature = "stdio_locked" , issue = "none" ) ]
1052- pub fn into_lock ( self ) -> StderrOwnedLock {
1009+ pub fn into_locked ( self ) -> StderrLock < ' static > {
10531010 self . lock_any ( )
10541011 }
10551012}
0 commit comments