diff options
| author | Steve Klabnik <steve@steveklabnik.com> | 2015-01-22 18:09:59 -0500 |
|---|---|---|
| committer | Steve Klabnik <steve@steveklabnik.com> | 2015-01-22 18:09:59 -0500 |
| commit | 22ed381ada895b9aee4e8fcd214f0d6f40d49d87 (patch) | |
| tree | d4abd7aefa38ed11328f1d11ebe2da584178e596 /src/libstd | |
| parent | 0b793ea619c2657cd4197d1ec1cf2d156e2a8f57 (diff) | |
| parent | bbbdd1086c5e08b12c6bf7193b15b9e8381c3fb2 (diff) | |
| download | rust-22ed381ada895b9aee4e8fcd214f0d6f40d49d87.tar.gz rust-22ed381ada895b9aee4e8fcd214f0d6f40d49d87.zip | |
Rollup merge of #21477 - steveklabnik:gh21440, r=alexcrichton
Fixes #21440"
Diffstat (limited to 'src/libstd')
| -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 35d305466b5..8cc2cac33ec 100644 --- a/src/libstd/sync/rwlock.rs +++ b/src/libstd/sync/rwlock.rs @@ -130,7 +130,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) } |
