pub trait ReadWriteLock<T>: 'static {
type ReadGuard<'l>: Deref<Target = T>;
type WriteGuard<'l>: DerefMut<Target = T>;
// Required methods
fn read_lock(&self) -> Self::ReadGuard<'_>;
fn write_lock(&self) -> Self::WriteGuard<'_>;
}
Expand description
Abstracts a read write lock (i.e. an RwLock).
Required Associated Types§
Sourcetype ReadGuard<'l>: Deref<Target = T>
type ReadGuard<'l>: Deref<Target = T>
The guard type returned when locking for reads (i.e. shared).
Sourcetype WriteGuard<'l>: DerefMut<Target = T>
type WriteGuard<'l>: DerefMut<Target = T>
The guard type returned when locking for writes (i.e. exclusive).
Required Methods§
Sourcefn write_lock(&self) -> Self::WriteGuard<'_>
fn write_lock(&self) -> Self::WriteGuard<'_>
Locks this lock for writing.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.