Skip to main content

Lock

Trait Lock 

Source
pub trait Lock:
    Send
    + Sync
    + Default {
    type Guard;
    type ReadGuard;

    // Required methods
    fn lock_owned(self: Arc<Self>) -> Self::Guard;
    fn try_lock_owned(self: Arc<Self>) -> Option<Self::Guard>;
    fn read_lock_owned(self: Arc<Self>) -> Self::ReadGuard;
}

Required Associated Types§

Required Methods§

Source

fn lock_owned(self: Arc<Self>) -> Self::Guard

Source

fn try_lock_owned(self: Arc<Self>) -> Option<Self::Guard>

Source

fn read_lock_owned(self: Arc<Self>) -> Self::ReadGuard

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Lock for Mutex<()>

Source§

type Guard = ArcMutexGuard<RawMutex, ()>

Source§

type ReadGuard = <Mutex<RawMutex, ()> as Lock>::Guard

Source§

fn lock_owned(self: Arc<Self>) -> Self::Guard

Source§

fn try_lock_owned(self: Arc<Self>) -> Option<Self::Guard>

Source§

fn read_lock_owned(self: Arc<Self>) -> Self::ReadGuard

Source§

impl Lock for RwLock<()>

Source§

type Guard = ArcRwLockWriteGuard<RawRwLock, ()>

Source§

type ReadGuard = ArcRwLockReadGuard<RawRwLock, ()>

Source§

fn lock_owned(self: Arc<Self>) -> Self::Guard

Source§

fn try_lock_owned(self: Arc<Self>) -> Option<Self::Guard>

Source§

fn read_lock_owned(self: Arc<Self>) -> Self::ReadGuard

Implementors§