pub fn try_write(&self) -> Result<RwLockWriteGuard<'_, T>, TryLockError> {
        match self.s.try_acquire(MAX_READS as u32) {
            Ok(permit) => permit,
            Err(TryAcquireError::NoPermits) => return Err(TryLockError(())),
            Err(TryAcquireError::Closed) => unreachable!(),
        }

        Ok(RwLockWriteGuard {
            s: &self.s,
            data: self.c.get(),
            marker: marker::PhantomData,
        })
    }
/// Attempts to acquire this `RwLock` with exclusive write access.
///
/// If the access couldn't be acquired immediately, returns [`TryLockError`].
/// Otherwise, an RAII guard is returned which will release write access
/// when dropped.
///
/// [`TryLockError`]: TryLockError
///
/// # Examples
///
/// ```
/// use tokio::sync::RwLock;
///
/// #[tokio::main]
/// async fn main() {
///     let rw = RwLock::new(1);
///
///     let v = rw.read().await;
///     assert_eq!(*v, 1);
///
///     assert!(rw.try_write().is_err());
/// }
/// ```
Attempts to acquire this `RwLock` with exclusive write access.
If the access couldn't be acquired immediately, returns [`TryLockError`].
Otherwise, an RAII guard is returned which will release write access
when dropped.


Attempts to acquire this ` RwLock ` with exclusive write access . If the access couldn ' t be acquired immediately returns [ ` TryLockError ` ] . Otherwise an RAII guard is returned which will release write access when dropped .
pub fn try_write(&self) -> Result<RwLockWriteGuard<'_, T>, TryLockError> {
        match self.s.try_acquire(MAX_READS as u32) {
            Ok(permit) => permit,
            Err(TryAcquireError::NoPermits) => return Err(TryLockError(())),
            Err(TryAcquireError::Closed) => unreachable!(),
        }
        Ok(RwLockWriteGuard {
            s: &self.s,
            data: self.c.get(),
            marker: marker::PhantomData,
        })
    }
pub fn try_write ( & self ) -> Result < RwLockWriteGuard < ' _ , T > , TryLockError > { match self . s . try_acquire ( MAX_READS as u32 ) { Ok ( permit ) => permit , Err ( TryAcquireError :: NoPermits ) => return Err ( TryLockError ( ( ) ) ) , Err ( TryAcquireError :: Closed ) => unreachable ! ( ) , } Ok ( RwLockWriteGuard { s : & self . s , data : self . c . get ( ) , marker : marker :: PhantomData , } ) }
Attempts to acquire this `RwLock` with exclusive write access.
Attempts to acquire this ` RwLock ` with exclusive write access .
&self
examples
```
use tokio::sync::RwLock.
` ` ` use tokio :: sync :: RwLock .
[tokio::main]
async fn main() {
let rw = RwLock::new(1).




async fn main () { let rw = RwLock :: new ( 1 ) .