mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-19 00:00:09 +02:00
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:
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user