Struct maitake_sync::OwnedMutexGuard
source · pub struct OwnedMutexGuard<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: ?Sized> Deref for OwnedMutexGuard<T>
impl<T: ?Sized> Deref for OwnedMutexGuard<T>
source§impl<T: ?Sized> DerefMut for OwnedMutexGuard<T>
impl<T: ?Sized> DerefMut for OwnedMutexGuard<T>
impl<T> Send for OwnedMutexGuard<T>
impl<T> Sync for OwnedMutexGuard<T>
Auto Trait Implementations§
impl<T> Freeze for OwnedMutexGuard<T>where
T: ?Sized,
impl<T> !RefUnwindSafe for OwnedMutexGuard<T>
impl<T> Unpin for OwnedMutexGuard<T>where
T: ?Sized,
impl<T> !UnwindSafe for OwnedMutexGuard<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