diff options
| author | Steve Klabnik <steve@steveklabnik.com> | 2015-01-21 14:54:17 -0500 |
|---|---|---|
| committer | Steve Klabnik <steve@steveklabnik.com> | 2015-01-21 14:54:52 -0500 |
| commit | bbbdd1086c5e08b12c6bf7193b15b9e8381c3fb2 (patch) | |
| tree | b1e891859ce7c585794ad0962842d8c4398a3aa7 /src/libstd/sync | |
| parent | 6869645e86c91544b8737b89809bdf10bef536d9 (diff) | |
| download | rust-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.rs | 10 |
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) } |
