pub fn borrow_mut(&self) -> Result<BorrowMut<'_, T>, AccessError> {
        // Safety: We know that interior value is alive since this container is
        // alive.
        //
        // Appropriate access is checked when constructing the guards.
        unsafe {
            let inner = self.inner.as_ref();
            let guard = inner.access.exclusive(AccessKind::Any)?;
            mem::forget(guard);
            Ok(BorrowMut::new(&mut *inner.data.get(), &inner.access))
        }
    }
/// Get a reference to the interior value while checking for exclusive access.
///
/// This prevents other shared or exclusive accesses from being performed
/// while the guard returned from this function is live.
///
/// # Examples
///
/// ```rust
/// use runestick::Shared;
///
/// #[derive(Debug)]
/// struct Foo {
///     counter: isize,
/// }
///
/// let a = Shared::new(Foo { counter: 0 });
///
/// {
///     let mut a_mut = a.borrow_mut().unwrap();
///     a_mut.counter += 1;
///     assert_eq!(a_mut.counter, 1);
///     assert!(a.borrow_ref().is_err());
/// }
///
/// let a = a.borrow_ref().unwrap();
/// assert_eq!(a.counter, 1);
/// ```
Get a reference to the interior value while checking for exclusive access.
This prevents other shared or exclusive accesses from being performed
while the guard returned from this function is live.
Get a reference to the interior value while checking for exclusive access . This prevents other shared or exclusive accesses from being performed while the guard returned from this function is live .
pub fn borrow_mut(&self) -> Result<BorrowMut<'_, T>, AccessError> {
        // Safety: We know that interior value is alive since this container is
        // alive.
        //
        // Appropriate access is checked when constructing the guards.
        unsafe {
            let inner = self.inner.as_ref();
            let guard = inner.access.exclusive(AccessKind::Any)?;
            mem::forget(guard);
            Ok(BorrowMut::new(&mut *inner.data.get(), &inner.access))
        }
    }
pub fn borrow_mut ( & self ) -> Result < BorrowMut < ' _ , T > , AccessError > { // Safety: We know that interior value is alive since this container is // alive. // // Appropriate access is checked when constructing the guards. unsafe { let inner = self . inner . as_ref ( ) ; let guard = inner . access . exclusive ( AccessKind :: Any ) ? ; mem :: forget ( guard ) ; Ok ( BorrowMut :: new ( & mut * inner . data . get ( ) , & inner . access ) ) } }
Get a reference to the interior value while checking for exclusive access.
Get a reference to the interior value while checking for exclusive access .
&self
&self
examples
```rust
use runestick::Shared.
` ` ` rust use runestick :: Shared .
[derive(debug)]
struct Foo {
counter: isize,
}

let a = Shared::new(Foo { counter: 0 }).

{
let mut a_mut = a.borrow_mut().unwrap();
a_mut.counter += 1;
assert_eq!(a_mut.counter, 1);
assert!(a.borrow_ref().is_err());
}


struct Foo { counter : isize } let a = Shared :: new ( Foo { counter : 0 } ) . { let mut a_mut = a . borrow_mut () . unwrap () ; a_mut . counter + = 1 ; assert_eq! ( a_mut . counter 1 ) ; assert! ( a . borrow_ref () . is_err () ) ; }