Trait lock_order::lock::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.

Object Safety§

This trait is not object safe.

Implementors§