pub fn try_lock(&self) -> Result<MutexGuard<'_, T>, TryLockError> {
        match self.s.try_acquire(1) {
            Ok(_) => Ok(MutexGuard { lock: self }),
            Err(_) => Err(TryLockError(())),
        }
    }
/// Attempts to acquire the lock, and returns [`TryLockError`] if the
/// lock is currently held somewhere else.
///
/// [`TryLockError`]: TryLockError
/// # Examples
///
/// ```
/// use tokio::sync::Mutex;
/// # async fn dox() -> Result<(), tokio::sync::TryLockError> {
///
/// let mutex = Mutex::new(1);
///
/// let n = mutex.try_lock()?;
/// assert_eq!(*n, 1);
/// # Ok(())
/// # }
/// ```
Attempts to acquire the lock, and returns [`TryLockError`] if the
lock is currently held somewhere else.


Attempts to acquire the lock and returns [ ` TryLockError ` ] if the lock is currently held somewhere else .
pub fn try_lock(&self) -> Result<MutexGuard<'_, T>, TryLockError> {
        match self.s.try_acquire(1) {
            Ok(_) => Ok(MutexGuard { lock: self }),
            Err(_) => Err(TryLockError(())),
        }
    }
pub fn try_lock ( & self ) -> Result < MutexGuard < ' _ , T > , TryLockError > { match self . s . try_acquire ( 1 ) { Ok ( _ ) => Ok ( MutexGuard { lock : self } ) , Err ( _ ) => Err ( TryLockError ( ( ) ) ) , } }
Attempts to acquire the lock, and returns [`TryLockError`] if the
lock is currently held somewhere else.
Attempts to acquire the lock and returns [ ` TryLockError ` ] if the lock is currently held somewhere else .
&self
examples
```
use tokio::sync::Mutex.
` ` ` use tokio :: sync :: Mutex .
async fn dox() -> result<(), tokio::sync::trylockerror> {
let mutex = Mutex::new(1).


let mutex = Mutex :: new ( 1 ) .
ok(())
None
}
None