starnix_sync

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

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.

Implementors§

Source§

impl<T, L: LockAfter<UninterruptibleLock>> LockFor<L> for OrderedMutex<T, L>

Source§

type Data = T

Source§

type Guard<'a> = MutexGuard<'a, TracingWrapper<RawSyncMutex>, T> where T: 'a, L: 'a