@@ -256,9 +256,23 @@ fn handle_ebadf<T>(r: io::Result<T>, default: T) -> io::Result<T> {
256256/// [`BufRead`]: trait.BufRead.html 
257257/// 
258258/// ### Note: Windows Portability Consideration 
259+ /// 
259260/// When operating in a console, the Windows implementation of this stream does not support 
260261/// non-UTF-8 byte sequences. Attempting to read bytes that are not valid UTF-8 will return 
261262/// an error. 
263+ /// 
264+ /// # Examples 
265+ /// 
266+ /// ```no_run 
267+ /// use std::io::{self, Read}; 
268+ /// 
269+ /// fn main() -> io::Result<()> { 
270+ ///     let mut buffer = String::new(); 
271+ ///     let mut stdin = io::stdin(); // We get `Stdin` here. 
272+ ///     stdin.read_to_string(&mut buffer)?; 
273+ ///     Ok(()) 
274+ /// } 
275+ /// ``` 
262276#[ stable( feature = "rust1" ,  since = "1.0.0" ) ]  
263277pub  struct  Stdin  { 
264278    inner :  Arc < Mutex < BufReader < Maybe < StdinRaw > > > > , 
@@ -274,9 +288,26 @@ pub struct Stdin {
274288/// [`Stdin::lock`]: struct.Stdin.html#method.lock 
275289/// 
276290/// ### Note: Windows Portability Consideration 
291+ /// 
277292/// When operating in a console, the Windows implementation of this stream does not support 
278293/// non-UTF-8 byte sequences. Attempting to read bytes that are not valid UTF-8 will return 
279294/// an error. 
295+ /// 
296+ /// # Examples 
297+ /// 
298+ /// ```no_run 
299+ /// use std::io::{self, Read}; 
300+ /// 
301+ /// fn main() -> io::Result<()> { 
302+ ///     let mut buffer = String::new(); 
303+ ///     let stdin = io::stdin(); // We get `Stdin` here. 
304+ ///     { 
305+ ///         let mut stdin_lock = stdin.lock(); // We get `StdinLock` here. 
306+ ///         stdin_lock.read_to_string(&mut buffer)?; 
307+ ///     } // `StdinLock` is dropped here. 
308+ ///     Ok(()) 
309+ /// } 
310+ /// ``` 
280311#[ stable( feature = "rust1" ,  since = "1.0.0" ) ]  
281312pub  struct  StdinLock < ' a >  { 
282313    inner :  MutexGuard < ' a ,  BufReader < Maybe < StdinRaw > > > , 
0 commit comments