From: Steve Klabnik Date: Wed, 21 Jan 2015 19:54:17 +0000 (-0500) Subject: Improve RwLock::new's docs X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=bbbdd1086c5e08b12c6bf7193b15b9e8381c3fb2;p=rust.git Improve RwLock::new's docs Fixes #21440" --- diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs index 237f6d08a95..f773e360ef8 100644 --- a/src/libstd/sync/rwlock.rs +++ b/src/libstd/sync/rwlock.rs @@ -157,7 +157,15 @@ pub struct RwLockWriteGuard<'a, T: 'a> { impl<'a, T> !marker::Send for RwLockWriteGuard<'a, T> {} impl RwLock { - /// Creates a new instance of an RwLock which is unlocked and read to go. + /// Creates a new instance of an `RwLock` which is unlocked. + /// + /// # Examples + /// + /// ``` + /// use std::sync::RwLock; + /// + /// let lock = RwLock::new(5); + /// ``` #[stable] pub fn new(t: T) -> RwLock { RwLock { inner: box RW_LOCK_INIT, data: UnsafeCell::new(t) }