Struct dioxus_hooks::RefCell
source · pub struct RefCell<T>where
T: ?Sized,{ /* private fields */ }
Expand description
A clone of the standard library’s RefCell
type.
Implementations§
source§impl<T> RefCell<T>
impl<T> RefCell<T>
sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Consumes the RefCell
, returning the wrapped value.
source§impl<T> RefCell<T>where
T: ?Sized,
impl<T> RefCell<T>where T: ?Sized,
sourcepub fn borrow(&self) -> Ref<'_, T>
pub fn borrow(&self) -> Ref<'_, T>
Immutably borrows the wrapped value.
The borrow lasts until the returned Ref
exits scope. Multiple
immutable borrows can be taken out at the same time.
Panics
Panics if the value is currently mutably borrowed.
sourcepub fn try_borrow(&self) -> Result<Ref<'_, T>, BorrowError>
pub fn try_borrow(&self) -> Result<Ref<'_, T>, BorrowError>
Immutably borrows the wrapped value.
The borrow lasts until the returned Ref
exits scope. Multiple
immutable borrows can be taken out at the same time.
Panics
Panics if the value is currently mutably borrowed.
sourcepub fn borrow_mut(&self) -> RefMut<'_, T>
pub fn borrow_mut(&self) -> RefMut<'_, T>
Mutably borrows the wrapped value.
The borrow lasts until the returned RefMut
exits scope. The value
cannot be borrowed while this borrow is active.
Panics
Panics if the value is currently borrowed.
sourcepub fn try_borrow_mut(&self) -> Result<RefMut<'_, T>, BorrowMutError>
pub fn try_borrow_mut(&self) -> Result<RefMut<'_, T>, BorrowMutError>
Tries borrowing the wrapped value mutably.
The borrow lasts until the returned RefMut
exits scope. The value
cannot be borrowed while this borrow is active.