Struct std::sync::remutex::ReentrantMutexGuard
source · pub struct ReentrantMutexGuard<'a, T: 'a> {
lock: &'a ReentrantMutex<T>,
}
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 implementation.
Mutability
Unlike MutexGuard
, ReentrantMutexGuard
does not implement DerefMut
,
because implementation of the trait would violate Rust’s reference aliasing
rules. Use interior mutability (usually RefCell
) in order to mutate the
guarded data.
Fields§
§lock: &'a ReentrantMutex<T>
Trait Implementations§
source§impl<T> Deref for ReentrantMutexGuard<'_, T>
impl<T> Deref for ReentrantMutexGuard<'_, T>
source§impl<T> Drop for ReentrantMutexGuard<'_, T>
impl<T> Drop for ReentrantMutexGuard<'_, T>
impl<T> !Send for ReentrantMutexGuard<'_, T>
Auto Trait Implementations§
impl<'a, T> RefUnwindSafe for ReentrantMutexGuard<'a, T>
impl<'a, T> Sync for ReentrantMutexGuard<'a, T>where T: Send,
impl<'a, T> Unpin for ReentrantMutexGuard<'a, T>
impl<'a, T> UnwindSafe for ReentrantMutexGuard<'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