pub enum RCell<T> {
Strong(Arc<T>),
Weak(Weak<T>),
Empty,
}
Expand description
A RCell holding either an Strong<T>
, a Weak<T>
or being Empty
.
Variants§
Implementations§
Source§impl<T> RCell<T>
impl<T> RCell<T>
Sourcepub fn refcount(&self) -> usize
pub fn refcount(&self) -> usize
Returns the number of strong references holding an object alive. The returned strong count is informal only, the result may be approximate and has race conditions when other threads modify the reference count concurrently.
Sourcepub fn retain(&mut self) -> Option<Strong<T>>
pub fn retain(&mut self) -> Option<Strong<T>>
Tries to upgrade this RCell from Weak
Sourcepub fn release(&mut self)
pub fn release(&mut self)
Downgrades the RCell, any associated value may become dropped when no other references exist. When no strong reference left remaining this cell becomes Empty.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for RCell<T>
impl<T> RefUnwindSafe for RCell<T>where
T: RefUnwindSafe,
impl<T> Send for RCell<T>
impl<T> Sync for RCell<T>
impl<T> Unpin for RCell<T>
impl<T> UnwindSafe for RCell<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