pub struct Mutex<T>(/* private fields */);Implementations§
Source§impl<T> Mutex<T>
impl<T> Mutex<T>
pub fn new(value: T) -> Self
pub fn lock_sync(&self) -> MutexGuard<'_, T>
Sourcepub fn try_lock(&self) -> Result<MutexGuard<'_, T>, NotAvailable>
pub fn try_lock(&self) -> Result<MutexGuard<'_, T>, NotAvailable>
Try to acquire the lock without blocking.
§Errors
Returns NotAvailable if the mutex is already held.
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> UnsafeUnpin for Mutex<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Mutex<T>where
T: 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