Struct tokio::sync::Mutex [−][src]
pub struct Mutex<T> { /* fields omitted */ }Expand description
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 lock, which
guarantees that the data is only ever accessed when the mutex is locked.
Implementations
impl<T> Mutex<T>[src]
impl<T> Mutex<T>[src]pub async fn lock(&self) -> MutexGuard<'_, T>[src]
pub async fn lock(&self) -> MutexGuard<'_, T>[src]A future that resolves on acquiring the lock and returns the MutexGuard.
pub fn try_lock(&self) -> Result<MutexGuard<'_, T>, TryLockError>[src]
pub fn try_lock(&self) -> Result<MutexGuard<'_, T>, TryLockError>[src]Tries to acquire the lock
Trait Implementations
impl<T> Send for Mutex<T> where
T: Send, [src]
T: Send,
impl<T> Sync for Mutex<T> where
T: Send, [src]
T: Send,
Auto Trait Implementations
impl<T> !RefUnwindSafe for Mutex<T>
impl<T> Unpin for Mutex<T> where
T: Unpin,
T: Unpin,