pub struct MyRefCell<T> { /* private fields */ }
Expand description
§Required to wrap value T in UnsafeCell
Because you are never allowed to cast a shared ref to an exclusive ref in other way than by going through the unsafe cell.
§Wrapping our RefState in Cell
Will give us ability to mutate Enum’s reference count through a shared reference
§Info
RefCell will enforce borrow rules at runtime.
§Common Usage
A fairly safe way to dynamically borrow data e.g Node in a graph/tree.
Implementations§
Auto Trait Implementations§
impl<T> !Freeze for MyRefCell<T>
impl<T> !RefUnwindSafe for MyRefCell<T>
impl<T> Send for MyRefCell<T>where
T: Send,
impl<T> !Sync for MyRefCell<T>
impl<T> Unpin for MyRefCell<T>where
T: Unpin,
impl<T> UnwindSafe for MyRefCell<T>where
T: UnwindSafe,
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