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
Auto Trait Implementations§
impl<R, T> !Freeze for BlockingMutex<R, T>
impl<R, T> RefUnwindSafe for BlockingMutex<R, T>where
R: RefUnwindSafe,
impl<R, T> Send for BlockingMutex<R, T>
impl<R, T> Sync for BlockingMutex<R, T>
impl<R, T> Unpin for BlockingMutex<R, T>
impl<R, T> UnwindSafe for BlockingMutex<R, T>where
R: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more