Add Mutex::into_inner method (#2250)

Add `Mutex::into_inner` method that consumes mutex
and return underlying value.

Fixes: #2211
This commit is contained in:
Waffle Lapkin
2020-02-17 11:16:48 -05:00
committed by GitHub
parent fc65951731
commit 09b5f47381
+5
View File
@@ -174,6 +174,11 @@ impl<T> Mutex<T> {
Err(_) => Err(TryLockError(())),
}
}
/// Consumes the mutex, returning the underlying data.
pub fn into_inner(self) -> T {
self.c.into_inner()
}
}
impl<'a, T> Drop for MutexGuard<'a, T> {