An asynchronous mutual exclusion primitive useful for protecting shared data
Each mutex has a type parameter (
T) which represents the data that it is protecting. The data
can only be accessed through the RAII guards returned from
guarantees that the data is only ever accessed when the mutex is locked.
Creates a new lock in an unlocked state ready for use.
pub async fn lock<'_, '_>(&'_ self) -> MutexGuard<'_, T>[src]
A future that resolves on acquiring the lock and returns the
pub fn try_lock(&self) -> Result<MutexGuard<T>, TryLockError>[src]
Try to acquire the lock
impl<T> !RefUnwindSafe for Mutex<T>
impl<T> !UnwindSafe for Mutex<T>
type Error = Infallible
The type returned in the event of a conversion error.