impl From<T> for RwLock<T>
This commit is contained in:
parent
1bfc6c1296
commit
0855ea1832
1 changed files with 11 additions and 0 deletions
|
@ -457,6 +457,17 @@ impl<T: Default> Default for RwLock<T> {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rw_lock_from", since = "1.22.0")]
|
||||
impl<T> From<T> for RwLock<T> {
|
||||
/// Creates a new instance of an `RwLock<T>` which is unlocked.
|
||||
/// This is equivalent to [`RwLock::new`].
|
||||
///
|
||||
/// [`RwLock::new`]: #method.new
|
||||
fn from(t: T) -> Self {
|
||||
RwLock::new(t)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'rwlock, T: ?Sized> RwLockReadGuard<'rwlock, T> {
|
||||
unsafe fn new(lock: &'rwlock RwLock<T>)
|
||||
-> LockResult<RwLockReadGuard<'rwlock, T>> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue