Skip to content

Commit 9125bb4

Browse files
authored
Added From<MutexGuard<'a, T>> for &'a Mutex<T> mutex.rs
1 parent f33a8c6 commit 9125bb4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

library/std/src/sync/mutex.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,12 @@ impl<T: ?Sized + Default> Default for Mutex<T> {
500500
}
501501
}
502502

503+
impl<'a, T> From<MutexGuard<'a, T>> for &'a Mutex<T>{
504+
fn from(value: MutexGuard<'a, T>) -> Self{
505+
value.lock
506+
}
507+
}
508+
503509
#[stable(feature = "rust1", since = "1.0.0")]
504510
impl<T: ?Sized + fmt::Debug> fmt::Debug for Mutex<T> {
505511
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {

0 commit comments

Comments
 (0)