Struct accountable_refcell::RefCell
source · pub struct RefCell<T: ?Sized> {
pub(crate) borrows: RefCell<BorrowData>,
pub(crate) inner: RefCell<T>,
}
Expand description
A RefCell that tracks outstanding borrows and reports stack traces for dynamic borrow failures.
Fields§
§borrows: RefCell<BorrowData>
§inner: RefCell<T>
Implementations§
source§impl<T> RefCell<T>
impl<T> RefCell<T>
sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Discard this RefCell and return the value stored inside of it.
source§impl<T: ?Sized> RefCell<T>
impl<T: ?Sized> RefCell<T>
sourcepub fn borrow(&self) -> Ref<'_, T>
pub fn borrow(&self) -> Ref<'_, T>
Borrow the value stored in this cell immutably. Panics if any outstanding mutable borrows of the same cell exist.
pub fn try_borrow(&self) -> Result<Ref<'_, T>, BorrowError>
sourcepub fn borrow_mut(&self) -> RefMut<'_, T>
pub fn borrow_mut(&self) -> RefMut<'_, T>
Borrow the value stored in this cell mutably. Panics if there are any other outstanding borrows of this cell (mutable borrows are unique, i.e. there can only be one).
pub fn try_borrow_mut(&self) -> Result<RefMut<'_, T>, BorrowMutError>
pub fn as_ptr(&self) -> *mut T
pub unsafe fn try_borrow_unguarded(&self) -> Result<&T, BorrowError>
Trait Implementations§
Auto Trait Implementations§
impl<T> !Freeze for RefCell<T>
impl<T> !RefUnwindSafe for RefCell<T>
impl<T> Send for RefCell<T>
impl<T> !Sync for RefCell<T>
impl<T> Unpin for RefCell<T>
impl<T> UnwindSafe for RefCell<T>where
T: UnwindSafe + ?Sized,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more