about summary refs log tree commit diff
path: root/src/libstd/sync
diff options
context:
space:
mode:
authorSteve Klabnik <steve@steveklabnik.com>2015-01-21 14:54:17 -0500
committerSteve Klabnik <steve@steveklabnik.com>2015-01-21 14:54:52 -0500
commitbbbdd1086c5e08b12c6bf7193b15b9e8381c3fb2 (patch)
treeb1e891859ce7c585794ad0962842d8c4398a3aa7 /src/libstd/sync
parent6869645e86c91544b8737b89809bdf10bef536d9 (diff)
downloadrust-bbbdd1086c5e08b12c6bf7193b15b9e8381c3fb2.tar.gz
rust-bbbdd1086c5e08b12c6bf7193b15b9e8381c3fb2.zip
Improve RwLock::new's docs
Fixes #21440"
Diffstat (limited to 'src/libstd/sync')
-rw-r--r--src/libstd/sync/rwlock.rs10
1 files changed, 9 insertions, 1 deletions
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<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) }