Trait lock_order::lock::LockFor

source ·
pub trait LockFor<L> {
    type Data;
    type Guard<'l>: DerefMut<Target = Self::Data>
       where Self: 'l;

    // Required method
    fn lock(&self) -> Self::Guard<'_>;
}
Expand description

Describes how to apply a lock type to the implementing type.

An implementation of LockFor<L> for some Self means that L is a valid lock level for Self, and defines how to access the state in Self 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 Guard<'l>: DerefMut<Target = Self::Data> where Self: 'l

A guard providing read and write access to the data.

Required Methods§

source

fn lock(&self) -> Self::Guard<'_>

Locks Self for lock L.

Object Safety§

This trait is not object safe.

Implementors§