pub trait RwLockFor<L> {
    type Data;
    type ReadGuard<'l>: Deref<Target = Self::Data>
       where Self: 'l;
    type WriteGuard<'l>: DerefMut<Target = Self::Data>
       where Self: 'l;

    // Required methods
    fn read_lock(&self) -> Self::ReadGuard<'_>;
    fn write_lock(&self) -> Self::WriteGuard<'_>;
}
Expand description

Describes how to acquire reader and writer locks to the implementing type.

An implementation of RwLockFor<L> for some Self means that Self can be used to unlock some state that is under the lock indicated by L.

Required Associated Types§

source

type Data

The data produced by locking the state indicated by L in Self.

source

type ReadGuard<'l>: Deref<Target = Self::Data> where Self: 'l

A guard providing read access to the data.

source

type WriteGuard<'l>: DerefMut<Target = Self::Data> where Self: 'l

A guard providing write access to the data.

Required Methods§

source

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

Acquires a read lock on the data in Self indicated by L.

source

fn write_lock(&self) -> Self::WriteGuard<'_>

Acquires a write lock on the data in Self indicated by L.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T, L> RwLockFor<L> for OrderedRwLock<T, L>

§

type Data = T

§

type ReadGuard<'a> = RwLockReadGuard<'a, TracingWrapper<RawSyncRwLock>, T> where T: 'a, L: 'a

§

type WriteGuard<'a> = RwLockWriteGuard<'a, TracingWrapper<RawSyncRwLock>, T> where T: 'a, L: 'a