Skip to main content

MutexLike

Trait MutexLike 

Source
pub trait MutexLike {
    type Guard<'a>
       where Self: 'a;
    type Context;

    // Required methods
    fn context() -> Self::Context;
    fn lock(&self, context: &mut Self::Context) -> Self::Guard<'_>;

    // Provided method
    fn key(&self) -> *const ()
       where Self: Sized { ... }
}
Expand description

A generic mutex for the ordered_lock operations.

Required Associated Types§

Source

type Guard<'a> where Self: 'a

Source

type Context

Required Methods§

Source

fn context() -> Self::Context

Source

fn lock(&self, context: &mut Self::Context) -> Self::Guard<'_>

Lock the mutex. level is the index of the locked mutex in the lock ordering.

Provided Methods§

Source

fn key(&self) -> *const ()
where Self: Sized,

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> MutexLike for DynamicLockDepMutex<T>

Source§

type Guard<'a> = LockDepGuard<'a, T> where T: 'a

Source§

type Context = ()

Source§

impl<T> MutexLike for Mutex<T>

Source§

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

Source§

type Context = ()

Source§

impl<T, L> MutexLike for LockDepMutex<T, L>

Source§

type Guard<'a> = LockDepGuard<'a, T> where T: 'a, L: 'a

Source§

type Context = <DynamicLockDepMutex<T> as MutexLike>::Context