pub struct PinWeak<T: ?Sized>(/* private fields */);Expand description
PinWeak<T> represents a non-owning reference to a pinned value managed by a
Pin<HybridRc<T, _>>.
The typical way to obtain a PinWeak<T> is to call HybridRc::downgrade_pin().
See Weak<T> for more information about weak references.
Implementations§
Source§impl<T: ?Sized> PinWeak<T>
impl<T: ?Sized> PinWeak<T>
Sourcepub fn upgrade_local(&self) -> Result<Pin<Rc<T>>, UpgradeError>
pub fn upgrade_local(&self) -> Result<Pin<Rc<T>>, UpgradeError>
Attempts to upgrade the pinned weak pointer to a pinned Rc.
See Weak::upgrade_local() for more information.
§Errors
ValueDropped: the referenced value has already been dropped.WrongThread: another thread currently holdsRcs for the value.
Sourcepub fn upgrade(&self) -> Result<Pin<Arc<T>>, UpgradeError>
pub fn upgrade(&self) -> Result<Pin<Arc<T>>, UpgradeError>
Attempts to upgrade the pinned weak pointer to a pinned Arc.
See Weak::upgrade() for more information.
§Errors
ValueDropped: the referenced value has already been dropped.
Sourcepub fn strong_count(&self) -> usize
pub fn strong_count(&self) -> usize
Gets a lower bound to the number of strong pointers to the inner value.
See Weak::strong_count() for more information.
Sourcepub fn weak_count(&self) -> usize
pub fn weak_count(&self) -> usize
Gets the number of Weak pointers to this allocation.
See Weak::strong_count() for more information.
Sourcepub unsafe fn into_inner_unchecked(self) -> Weak<T>
pub unsafe fn into_inner_unchecked(self) -> Weak<T>
Transforms this PinWeak<T> into a Weak<T>
§Safety
This function is unsafe. You must guarantee that you will continue to treat the Weak as
pinned after you call this function. Not maintaining the pinning invariants that is a
violation of the API contract and may lead to undefined behavior in later (safe) operations.
If the underlying data is Unpin, PinWeak::into_inner() should be used instead.
Trait Implementations§
Source§impl<T: ?Sized> Clone for PinWeak<T>
impl<T: ?Sized> Clone for PinWeak<T>
Source§fn clone(&self) -> Self
fn clone(&self) -> Self
Creates another pinned weak reference for the same value.
See Weak::clone() for more information.
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<T> Default for PinWeak<T>
impl<T> Default for PinWeak<T>
Source§fn default() -> Self
fn default() -> Self
Constructs a dummy PinWeak<T>, without allocating any memory.
See PinWeak<T>::new().