We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6869645 commit bbbdd10Copy full SHA for bbbdd10
src/libstd/sync/rwlock.rs
@@ -157,7 +157,15 @@ pub struct RwLockWriteGuard<'a, T: 'a> {
157
impl<'a, T> !marker::Send for RwLockWriteGuard<'a, T> {}
158
159
impl<T: Send + Sync> RwLock<T> {
160
- /// 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.
161
+ ///
162
+ /// # Examples
163
164
+ /// ```
165
+ /// use std::sync::RwLock;
166
167
+ /// let lock = RwLock::new(5);
168
169
#[stable]
170
pub fn new(t: T) -> RwLock<T> {
171
RwLock { inner: box RW_LOCK_INIT, data: UnsafeCell::new(t) }
0 commit comments