Skip to main content

ReadWriteLock

Trait ReadWriteLock 

Source
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§

Source

type ReadGuard<'l>: Deref<Target = T>

The guard type returned when locking for reads (i.e. shared).

Source

type WriteGuard<'l>: DerefMut<Target = T>

The guard type returned when locking for writes (i.e. exclusive).

Required Methods§

Source

fn read_lock(&self) -> Self::ReadGuard<'_>

Locks this lock for reading.

Source

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".

Implementors§