We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 451683f commit aeb3af8Copy full SHA for aeb3af8
src/libstd/io/stdio.rs
@@ -414,6 +414,21 @@ impl Stdout {
414
///
415
/// The lock is released when the returned lock goes out of scope. The
416
/// returned guard also implements the `Write` trait for writing data.
417
+ ///
418
+ /// # Examples
419
420
+ /// ```
421
+ /// use std::io::{self, Write};
422
423
+ /// # fn foo() -> io::Result<()> {
424
+ /// let stdout = io::stdout();
425
+ /// let mut handle = stdout.lock();
426
427
+ /// try!(handle.write(b"hello world"));
428
429
+ /// # Ok(())
430
+ /// # }
431
432
#[stable(feature = "rust1", since = "1.0.0")]
433
pub fn lock(&self) -> StdoutLock {
434
StdoutLock { inner: self.inner.lock().unwrap_or_else(|e| e.into_inner()) }
0 commit comments