pub fn borrow_ref(&self) -> Result<BorrowRef<'_, 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.shared(AccessKind::Any)?;
            mem::forget(guard);
            Ok(BorrowRef::new(&*inner.data.get(), &inner.access))
        }
    }
/// Get a reference to the interior value while checking for shared access.
///
/// This prevents other 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 });
///
/// a.borrow_mut().unwrap().counter += 1;
///
/// {
///     let mut a_ref = a.borrow_ref().unwrap();
///     assert_eq!(a_ref.counter, 1);
///     assert!(a.borrow_mut().is_err());
///     assert!(a.borrow_ref().is_ok());
/// }
///
/// let mut a = a.borrow_mut().unwrap();
/// a.counter += 1;
/// assert_eq!(a.counter, 2);
/// ```
Get a reference to the interior value while checking for shared access.
This prevents other exclusive accesses from being performed while the
guard returned from this function is live.
Get a reference to the interior value while checking for shared access . This prevents other exclusive accesses from being performed while the guard returned from this function is live .
pub fn borrow_ref(&self) -> Result<BorrowRef<'_, 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.shared(AccessKind::Any)?;
            mem::forget(guard);
            Ok(BorrowRef::new(&*inner.data.get(), &inner.access))
        }
    }
pub fn borrow_ref ( & self ) -> Result < BorrowRef < ' _ , 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 . shared ( AccessKind :: Any ) ? ; mem :: forget ( guard ) ; Ok ( BorrowRef :: new ( & * inner . data . get ( ) , & inner . access ) ) } }
Get a reference to the interior value while checking for shared access.
Get a reference to the interior value while checking for shared 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 }).

a.borrow_mut().unwrap().counter += 1.

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

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