pub struct BlockingMutex<R: RawMutex, T> { /* private fields */ }Expand description
A wrap of std::sync::Mutex. This type’s purpose is to allow choosing
between using std::sync::Mutex or BlockingMutex through feature flags.
Implementations§
Source§impl<R: RawMutex, T> BlockingMutex<R, T>
impl<R: RawMutex, T> BlockingMutex<R, T>
Sourcepub const fn new(val: T) -> BlockingMutex<R, T>
pub const fn new(val: T) -> BlockingMutex<R, T>
Creates a new Mutex.
Sourcepub fn lock(&self) -> MutexGuard<'_, T>
pub fn lock(&self) -> MutexGuard<'_, T>
lock
Sourcepub fn try_lock(&self) -> Option<MutexGuard<'_, T>>
pub fn try_lock(&self) -> Option<MutexGuard<'_, T>>
try_lock
Sourcepub fn try_with_lock<U>(&self, f: impl FnOnce(&mut T) -> U) -> Option<U>
pub fn try_with_lock<U>(&self, f: impl FnOnce(&mut T) -> U) -> Option<U>
try_with_lock