Struct std::sync::mutex::MutexGuard
1.0.0 · source · pub struct MutexGuard<'a, T: ?Sized + 'a> {
lock: &'a Mutex<T>,
poison: Guard,
}
Expand description
An RAII implementation of a “scoped lock” of a mutex. When this structure is dropped (falls out of scope), the lock will be unlocked.
The data protected by the mutex can be accessed through this guard via its
Deref
and DerefMut
implementations.
This structure is created by the lock
and try_lock
methods on
Mutex
.
Fields§
§lock: &'a Mutex<T>
§poison: Guard
Implementations§
source§impl<'mutex, T: ?Sized> MutexGuard<'mutex, T>
impl<'mutex, T: ?Sized> MutexGuard<'mutex, T>
unsafe fn new(lock: &'mutex Mutex<T>) -> LockResult<MutexGuard<'mutex, T>>
Trait Implementations§
source§impl<T: ?Sized> Deref for MutexGuard<'_, T>
impl<T: ?Sized> Deref for MutexGuard<'_, T>
source§impl<T: ?Sized> DerefMut for MutexGuard<'_, T>
impl<T: ?Sized> DerefMut for MutexGuard<'_, T>
source§impl<T: ?Sized> Drop for MutexGuard<'_, T>
impl<T: ?Sized> Drop for MutexGuard<'_, T>
impl<T: ?Sized> !Send for MutexGuard<'_, T>
impl<T: ?Sized + Sync> Sync for MutexGuard<'_, T>
Auto Trait Implementations§
impl<'a, T: ?Sized> RefUnwindSafe for MutexGuard<'a, T>
impl<'a, T: ?Sized> Unpin for MutexGuard<'a, T>
impl<'a, T: ?Sized> UnwindSafe for MutexGuard<'a, T>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more