pub struct Mutex<T> { /* private fields */ }
Expand description
Wrapper for std::sync::Mutex
.
Refer to the crate-level documentation for the differences between this struct and the one it wraps.
Implementations§
Source§impl<T> Mutex<T>
impl<T> Mutex<T>
Sourcepub fn lock(&self) -> LockResult<MutexGuard<'_, T>>
pub fn lock(&self) -> LockResult<MutexGuard<'_, T>>
Wrapper for std::sync::Mutex::lock
.
§Panics
This method participates in lock dependency tracking. If acquiring this lock introduces a dependency cycle, this method will panic.
Sourcepub fn try_lock(&self) -> TryLockResult<MutexGuard<'_, T>>
pub fn try_lock(&self) -> TryLockResult<MutexGuard<'_, T>>
Wrapper for std::sync::Mutex::try_lock
.
§Panics
This method participates in lock dependency tracking. If acquiring this lock introduces a dependency cycle, this method will panic.
Sourcepub fn is_poisoned(&self) -> bool
pub fn is_poisoned(&self) -> bool
Wrapper for std::sync::Mutex::is_poisoned
.
Sourcepub fn get_mut(&mut self) -> LockResult<&mut T>
pub fn get_mut(&mut self) -> LockResult<&mut T>
Return a mutable reference to the underlying data.
This method does not block as the locking is handled compile-time by the type system.
Sourcepub fn into_inner(self) -> LockResult<T>
pub fn into_inner(self) -> LockResult<T>
Unwrap the mutex and return its inner value.
Trait Implementations§
Auto Trait Implementations§
impl<T> !Freeze for Mutex<T>
impl<T> RefUnwindSafe for Mutex<T>
impl<T> Send for Mutex<T>where
T: Send,
impl<T> Sync for Mutex<T>where
T: Send,
impl<T> Unpin for Mutex<T>where
T: Unpin,
impl<T> UnwindSafe for Mutex<T>
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