]> git.lizzy.rs Git - rust.git/commitdiff
Improve RwLock::new's docs
authorSteve Klabnik <steve@steveklabnik.com>
Wed, 21 Jan 2015 19:54:17 +0000 (14:54 -0500)
committerSteve Klabnik <steve@steveklabnik.com>
Wed, 21 Jan 2015 19:54:52 +0000 (14:54 -0500)
Fixes #21440"

src/libstd/sync/rwlock.rs

index 237f6d08a9541885314e25706655aebf614f760b..f773e360ef87542676ecc0cdcc03b9ebcb8f1dc3 100644 (file)
@@ -157,7 +157,15 @@ pub struct RwLockWriteGuard<'a, T: 'a> {
 impl<'a, T> !marker::Send for RwLockWriteGuard<'a, T> {}
 
 impl<T: Send + Sync> RwLock<T> {
-    /// Creates a new instance of an RwLock which is unlocked and read to go.
+    /// Creates a new instance of an `RwLock<T>` which is unlocked.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use std::sync::RwLock;
+    ///
+    /// let lock = RwLock::new(5);
+    /// ```
     #[stable]
     pub fn new(t: T) -> RwLock<T> {
         RwLock { inner: box RW_LOCK_INIT, data: UnsafeCell::new(t) }