ReentrantLockGuard in std::sync - Rust (original) (raw)
Struct ReentrantLockGuard
pub struct ReentrantLockGuard<'a, T: ?Sized + 'a> { /* private fields */ }
🔬This is a nightly-only experimental API. (reentrant_lock
#121440)
Expand description
An RAII implementation of a “scoped lock” of a re-entrant lock. 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 itsDeref implementation.
This structure is created by the lock method onReentrantLock.
§Mutability
Unlike MutexGuard, ReentrantLockGuard
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.