pub struct RefContainer<T>(/* private fields */);
Expand description
Allows access to the underlying data persisted with use_ref()
.
§Panics
The rules of borrowing will be enforced at runtime through a RefCell
,
therefore the methods RefContainer::current()
,
RefContainer::current_mut()
, and RefContainer::set_current()
may
panic accordingly.
Implementations§
Source§impl<T: 'static> RefContainer<T>
impl<T: 'static> RefContainer<T>
Sourcepub fn current(&self) -> Ref<'_, T>
pub fn current(&self) -> Ref<'_, T>
Returns a reference to the underlying data.
§Panics
Panics if the underlying data is currently mutably borrowed.
Sourcepub fn current_mut(&mut self) -> RefMut<'_, T>
pub fn current_mut(&mut self) -> RefMut<'_, T>
Returns a mutable reference to the underlying data.
§Panics
Panics if the underlying data is currently borrowed.
Sourcepub fn set_current(&mut self, value: T)
pub fn set_current(&mut self, value: T)
Sets the underlying data to the given value.
§Panics
Panics if the underlying data is currently borrowed.
Trait Implementations§
Source§impl<T> Clone for RefContainer<T>
impl<T> Clone for RefContainer<T>
Source§impl<T: Debug> Debug for RefContainer<T>
impl<T: Debug> Debug for RefContainer<T>
Source§impl<T> From<RefContainer<T>> for PropContainer<T>
impl<T> From<RefContainer<T>> for PropContainer<T>
Source§fn from(value: RefContainer<T>) -> Self
fn from(value: RefContainer<T>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<T> Freeze for RefContainer<T>
impl<T> !RefUnwindSafe for RefContainer<T>
impl<T> !Send for RefContainer<T>
impl<T> !Sync for RefContainer<T>
impl<T> Unpin for RefContainer<T>
impl<T> !UnwindSafe for RefContainer<T>
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