From bbbdd1086c5e08b12c6bf7193b15b9e8381c3fb2 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Wed, 21 Jan 2015 14:54:17 -0500 Subject: [PATCH] Improve RwLock::new's docs Fixes #21440" --- src/libstd/sync/rwlock.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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) } -- 2.44.0