Immutably borrows the wrapped value, returning an error if the value is currently mutably borrowed.
(&self)
| 145 | /// Immutably borrows the wrapped value, returning an error if the value |
| 146 | /// is currently mutably borrowed. |
| 147 | pub fn try_borrow(&self) -> result::Result<Ref<'a, T>, BorrowError> { |
| 148 | // state isn't involved since |
| 149 | // - data.try_borrow() would fail if self is mutably borrowed, |
| 150 | // - and data.try_borrow_mut() would fail while self is borrowed. |
| 151 | self.data.try_borrow() |
| 152 | } |
| 153 | |
| 154 | /// Mutably borrows the wrapped value. |
| 155 | /// |