pub enum RCell<T> {
Strong(Strong<T>),
Weak(Weak<T>),
Empty,
}
Expand description
A RCell holding either an Strong<T>
, a Weak<T>
or being Empty
.
Creates a new strong (Strong) RCell from the supplied value.
Returns ‘true’ when this RCell contains a Strong<T>
.
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.
Tries to upgrade this RCell from Weak to Strong. This means that as long the RCell
is not dropped the associated data won’t be either. When successful it returns
Some<Strong> containing the value, otherwise None is returned on failure.
Downgrades the RCell, any associated value may become dropped when no other references
exist. When no strong reference left remaining this cell becomes Empty.
Removes the reference to the value. The rationale for this function is to release
any resource associated with a RCell (potentially member of a struct that lives
longer) in case one knows that it will never be upgraded again.
Tries to get an Strong<T>
from the RCell. This may fail if the RCell was Weak and all
other strong references became dropped.
Formats the value using the given formatter.
Read more
Creates an RCell that doesn’t hold any reference.
Creates a new strong RCell with the supplied Strong<T>
.
Creates a new weak RCell with the supplied Weak<T>
.
Replaces the RCell with the supplied Strong<T>
. The old entry becomes dropped.
Replaces the RCell with the supplied Weak<T>
. The old entry becomes dropped.
Immutably borrows from an owned value.
Read more
Mutably borrows from an owned value.
Read more
Returns the argument unchanged.
Calls U::from(self)
.
That is, this conversion is whatever the implementation of
From<T> for U
chooses to do.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.