Struct maitake::sync::mutex::OwnedMutexGuard
source · pub struct OwnedMutexGuard<T, L>where
L: ScopedRawMutex,
T: ?Sized,{ /* private fields */ }
Available on crate feature
alloc
only.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.
This type is similar to the MutexGuard
type, but it is only returned
by a Mutex
that is wrapped in an an Arc
. Instead of borrowing
the Mutex
, this guard holds an Arc
clone of the Mutex
,
incrementing its reference count. Therefore, this type can outlive the
Mutex
that created it, and it is valid for the 'static
lifetime.
The data protected by the mutex can be accessed through this guard via its
Deref
and DerefMut
implementations.
This guard can be held across any .await
point, as it implements
Send
.
This structure is created by the lock_owned
and try_lock_owned
methods on Mutex
.
Trait Implementations§
source§impl<T, L> Debug for OwnedMutexGuard<T, L>
impl<T, L> Debug for OwnedMutexGuard<T, L>
source§impl<T, L> Deref for OwnedMutexGuard<T, L>where
L: ScopedRawMutex,
T: ?Sized,
impl<T, L> Deref for OwnedMutexGuard<T, L>where
L: ScopedRawMutex,
T: ?Sized,
source§impl<T, L> DerefMut for OwnedMutexGuard<T, L>where
L: ScopedRawMutex,
T: ?Sized,
impl<T, L> DerefMut for OwnedMutexGuard<T, L>where
L: ScopedRawMutex,
T: ?Sized,
impl<T, L> Send for OwnedMutexGuard<T, L>
impl<T, L> Sync for OwnedMutexGuard<T, L>
Auto Trait Implementations§
impl<T, L> !RefUnwindSafe for OwnedMutexGuard<T, L>
impl<T: ?Sized, L> Unpin for OwnedMutexGuard<T, L>
impl<T, L> !UnwindSafe for OwnedMutexGuard<T, L>
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