pub struct MutexGuard<'a, T: ?Sized + 'a> { /* private fields */ }
Expand description
A handle to a held Mutex
. The guard can be held across any .await
.
As long as you have this guard, you have exclusive access to the underlying
T
. The guard internally borrows the Mutex
, so the mutex will not be
dropped while a guard exists. To access T
data use Deref
and DerefMut
methods or operators.
The lock is automatically released whenever the guard is dropped, at which
point lock
will succeed yet again.
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>
Auto Trait Implementations§
impl<'a, T> !RefUnwindSafe for MutexGuard<'a, T>
impl<'a, T> !Send for MutexGuard<'a, T>
impl<'a, T> !Sync for MutexGuard<'a, T>
impl<'a, T: ?Sized> Unpin for MutexGuard<'a, T>
impl<'a, T> !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