pub(crate) struct RcCell<T> {
inner: UnsafeCell<Option<Rc<T>>>,
}
Expand description
This is exactly like Cell<Option<Rc<T>>>
, except that it provides a get
method even though Rc
is not Copy
.
Fields§
§inner: UnsafeCell<Option<Rc<T>>>
Implementations§
source§impl<T> RcCell<T>
impl<T> RcCell<T>
pub(crate) const fn new() -> Self
sourceunsafe fn with_inner<F, R>(&self, f: F) -> R
unsafe fn with_inner<F, R>(&self, f: F) -> R
Safety: This method may not be called recursively.
pub(crate) fn get(&self) -> Option<Rc<T>>
pub(crate) fn replace(&self, val: Option<Rc<T>>) -> Option<Rc<T>>
pub(crate) fn set(&self, val: Option<Rc<T>>)
Auto Trait Implementations§
impl<T> !Freeze for RcCell<T>
impl<T> !RefUnwindSafe for RcCell<T>
impl<T> !Send for RcCell<T>
impl<T> !Sync for RcCell<T>
impl<T> Unpin for RcCell<T>
impl<T> UnwindSafe for RcCell<T>where
T: RefUnwindSafe,
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